c# - What is the effect of IsPostBack Condition? -
c# - What is the effect of IsPostBack Condition? -
i have aspx page using ajax.
<asp:updatepanel runat="server" id="uppanelddlprogram"> <contenttemplate> <asp:dropdownlist id="ddlprogram" runat="server" width="194px" height="18px" onselectedindexchanged="onddlprogramchanged" autopostback="true"> </asp:dropdownlist> </contenttemplate> </asp:updatepanel>
and code behind like
protected void page_load(object sender, eventargs e) { //if (!ispostback) //{ // bindprogramddl(); //} bindprogramddl(); } protected void bindprogramddl() { list<ccprogramentity> programentities = formsalesubmit_bao.getallprograms(); ddlprogram.datasource = programentities; ddlprogram.datatextfield = "shortname"; ddlprogram.datavaluefield = "id"; ddlprogram.databind(); string programcode = programentities[ddlprogram.selectedindex].code; } protected void onddlprogramchanged(object sender, eventargs e) { list<ccprogramentity> programentities = formsalesubmit_bao.getallprograms(); string programcode = programentities[ddlprogram.selectedindex].code; }
the if status page load event, commented out. if toggle comment part of page load event, works perfect in both cases. question why heppening?
if getting right .......
dropdown list has info not binding sec time after post back..........its becasuse server side command , each serverside command has view state it thats y not removing data.
ispostback - true when post using serverside command dropdown, checkbox , textbox............when load page first time property false in subsequent request same page value of property true. can check msdn document more detail it.
c# asp.net asp.net-ajax postback
Comments
Post a Comment