Is there a way to trigger an updatepanel without a click event?
I'm trying to load parts of a p开发者_StackOverflow社区age at a time instead of doing all my calculations in the onLoad page event, then displaying all the calculations at once.
I think one of the ways to mimic a faster loading page is to separate parts of the page into updatepanels (correct me if I'm wrong in this approach). As such, I'm wondering if there is a way to execute some code in the onLoad event, display that on the page, then continue some other work in updatepanels and load those as they get completed.
UpdatePanels are a poor implementation of ajax. Since only a section of the page is being updated, it is easy (too easy) to think that you have reduced the execution time of your page. An UpdatePanel performs a postback and as such executes the entire life cycle of your page (lamely put, it will execute the PageLoad for your page and every usercontrol on your page not just the ones that are in the UpdatePanel). Unless you put lots of if !Page.IsPostBack
in your code, you could actually end up slowing your application down. Also, since it is a postback, it will submit the runat='server' form that is on your page and submit every input (not just the stuff in the update panel) to the server, which means you aren't saving anything on payload and bandwidth by using an update panel.
to answer your question though, you just need to call __doPostBack('updatepanel1', ''). reference http://encosia.com/easily-refresh-an-updatepanel-using-javascript/
You can call the .Update method on the UpdatePanel. Set the UpdateMode to be Conditional and handle all of the Update panel updating by hand in code.
精彩评论