I have two user controls on a page - UC1,UC2. Each usercontrol have a asp:button. Now if I click the any of the buttons the page post back. Now if I click the button of UC1 then the following happen.
- Viewstate load for two user controls.
- Page load called for two user controls.
- The event handler of UC1 button is fired.
Now if user click on the UC1 button, I do not want to load the view state of UC2 user controls at server because the viewstate of U开发者_如何学编程C2 is large. The execution of UC1 is not dependent of UC2.
Please suggest how can I achive this.
Thanks!
What it sounds like your asking for is the ability to do partial postbacks. That is postbacks that only affect a portion of the page. There are a number of ways to accomplish this such as using the Microsoft provided AJAX controls (http://www.asp.net/ajax) or rolling your own with JQuery and web methods (this method however is stateless and should be expected as such). Specifically you will want to look at UpdatePanels and PostBack Triggers.
Hope this helps.
精彩评论