Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 75763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:34:02+00:00 2026-05-10T20:34:02+00:00

Yes, there is a similar question here . However, that question doesn’t seem to

  • 0

Yes, there is a similar question here. However, that question doesn’t seem to have code attached to it (though it might have at some point; I see answers alluding to code), and the accepted answer (and other advice) on it aren’t getting me where I need to be.

I have a fairly complex, and frankly not-well-designed VB.NET web app I’m extending with a new feature. The short form of the feature is that it allows administrative users to reposition certain elements on the home page. Redesigning for web parts is not an option at this stage.

The administrative page which allows the resizing uses simple user controls to represent each of the ‘boxes’ on the home page which can be moved (forgive my ascii art):

+------------+ | Box Title  | +------------+ |     /\     | |   < X  >   | |     \/     | +------------+ 

The four arrows (and the center X — or eye, depending on visibility of the box) are ImageButtons. Each ImageButton‘s Click event is wired to code similar to the following:

RaiseEvent WidgetMoved(Me, New WidgetMovedEventArgs(WidgetMoveDirection.Up, widgetIDField.Value)) 

The hosting page (which is itself on a MasterPage) initiates these user controls after binding to the data which determines where they are positioned:

For i as Integer = 0 To count     Dim widget As MyWidget = widgets(i) '' widgets is a collection     Dim box as controls_CustomizeWidget = BindWidget(WidgetColumns.Left, i, count, widget) '' This simply uses LoadControl and places the control in one of two placeholders     AddHandler box.WidgetMoved, AddressOf widget_WidgetMoved     AddHandler box.WidgetVisibleChanged, AddressOf widget_WidgetVisibleChanged  Next 

The method with this code is called at every page load, whether or not I’m in a postback. (I ‘live-save’ the data; you make a change, it saves to the database at that postback, then reloads.)

Every other postback, the user control button events do not fire. They initiate a new postback, and on this second one they fire fine. So, essentially, my controls require two clicks to get anything done.

Specifically, again, the controls are initialized in the Page.Load event handler. I tried out PreInit, but that didn’t work because the rest of the page structure isn’t built yet, and therefore trying to place them in their appropriate PlaceHolders fails with a NullReferenceException. I’ve searched around the web, and not seen anything like this, and I have to admit that in every other scenario where I raise events from user controls (such as every page of this site), there are no problems. On the other hand, this is the only page on the site where a user control with events is dynamically loaded at run-time …

I’m feeling pretty danged dumb at the moment. Any help getting the events to raise reliably, every time? What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:34:02+00:00Added an answer on May 10, 2026 at 8:34 pm

    I’ve had a similar issue that ended up being some code in the event handler that messed up the event getting re-wired to the buttons. I think it was that I was reloading the control after the click event had caused a change, but was recreating the controls’ container, rather than just rebinding.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Your code should work. But only after GridView.DataBind() has been… May 11, 2026 at 2:42 pm
  • added an answer Sql Server Database Publishing Wizard. Create a script with just… May 11, 2026 at 2:42 pm
  • added an answer I would probably introduce a Finalize method for the class… May 11, 2026 at 2:42 pm

Related Questions

Yes, there is a similar question here . However, that question doesn't seem to
The code base I'm currently working on is littered with hard-coded values. I view
I have a priority queue implementation in C# that I want to add a
Please pardon my C#.Net newbie status. If this is obvious and I missed it
Well I run a small video website and on the actual video page there

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.