views:

98

answers:

1

I'm using WebForms MVP to create some simple reporting applications. Most of these applications consist of a few search criteria inputs and a ComponentArt datagrid that I'm populating with data from the database.

Most of the markup is in a UserControl, which is in a content page with a master page. My problem is that the control's Page_Load event is firing before the control events that caused the postback in the first place. Basically, the user clicks the search button, and Page_Load is fired BEFORE Search_Click. This is messing with the databinding scheme I've been using.

So that's the question: Why is my Page_Load event firing before the event handler, and what can I do about it? I don't THINK this problem is related to WebForms MVP or ComponentArt, but obviously I could be wrong.

Thanks.

+1  A: 

"Why is my Page_Load event firing before the event handler?"

Because that's what is SUPPOSED to happen. It's by design. If this is messing up your databinding, then it's you are doing something wrong, because this is how all ASP.NET webforms applications work. If you don't want databinding to happen before Search_Click, then check for IsPostback during Page_Load... that's the primary reason the property is there.

Bryan