开发者

Working with DataBinding and Page_Load in ASP.NET MVP

开发者 https://www.devze.com 2022-12-26 01:46 出处:网络
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

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开发者_StackOverflow 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.


"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.

0

精彩评论

暂无评论...
验证码 换一张
取 消