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

  • SEARCH
  • Home
  • 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

Related Questions

Before you tell me that there is already a similar question, yes, i know,
Yes I know there has been similar posts to this however after looking through
There was a similar question asked here three years ago, but I want to
The question quite an older and often asked around, i have similar questions here
There is a very similar question already. One of the solutions uses code like
Yes, I know, the archive bit is evil. That being said, is there support
Yes, another IE fallback question. ;-) I had a look at the others here
Yes, the title is correct. Is there a way to code review a project
I understand that this question may seem somewhat ungrounded, but if someone knows anything
The title might be somewhat ambiguous, but bear with me (The only similar question

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.