c# - AutoPostBack: true vs false -


before begin, have seen this question similar topic (as this one , this one), none of answer question completely. understand concepts presented in these questions/answers, have more questions.

a) happens if have multiple controls autopostback="false" , change number of them before postback? take following brief example (assume else needed page written correctly , trivially; e.g., page_load):

default.aspx:

<asp:dropdownlist id="ddlfoo" runat="server"      onselectedindexchanged="ddlfoo_changed" autopostback="false" >     <asp:listitem text="a" />     <asp:listitem text="b" />     <asp:listitem text="c" /> </asp:dropdownlist> <asp:dropdownlist id="ddlbar" runat="server"      onselectedindexchanged="ddlbar_changed" autopostback="false" >     <asp:listitem text="1" />     <asp:listitem text="2" />     <asp:listitem text="3" /> </asp:dropdownlist> <asp:button id="btnqux" runat="sever" text="click postback" onclick="btnqux_click" 

default.aspx.cs:

protected void ddlfoo_changed(object sender, eventargs e) {     response.write("ddlfoo changed " + ddlfoo.text + ". "); } protected void ddlbar_changed(object sender, eventargs e) {     response.write("ddlbar changed " + ddlbar.text + ". "); } protected void btnqux_changed(object sender, eventargs e) { } 

now, change ddlfoo 3 , ddlbar b. then, click btnqux. following output response.write after clicking:

ddlbar changed b. ddlfoo changed 3.  

why happen? onselectedindexchanged methods put stack called once postback happens?

b) why webpage load more when use approach , set autopostback="false" of controls? specific, did checkbox, dropdownlist, , textbox in gridview, retrieved ~1200 rows , 27 columns of data , took 10s in vs2008 debug mode versus 310s before. why load/refresh time faster?

edit: released code earlier afternoon, , there no significant difference between load time of old (autopostback="true") , new (autopostback="false") versions. think perhaps debugger doing extra, caused large jump in load time. better way rephrase question b) might then: debugger have been doing cause large jump in load time?

warning: i'm no asp.net expert... if turns out garbage, i'll delete :)

a) believe see new values of controls, whenever postback ends happening, including change events, described. values have changed, after - autopostback affects timing (and whether postback occurs @ all, of course).

b) there's more javascript in html delivered autopostback = true on controls, not enough make enormous difference. noted in edit, looks transient issue anyway - can't explain transient issues without more diagnostics.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -