asp.net - Page OnLoad not fireing changing query string -
i have problem onload event not fireing when navigate page , change query string. if postback called, changing query string ones more onload gets called.
here how try. navigate page onload fires -> change query string page updates (all bound elements updated) onload not fire -> postback using button onload fires -> change query string onload fires.
i try explain in more detail.
the system has log in window when log in navigate other aspx page sending 2 query string messages last query string number (page.aspx?key=text82&key2=2010). when page first time pageload event gets called , fine, if in browser change key2 2011 , press enter pageload not called bound elements updated (grivview etc..). if postback using button pageload gets called. if change 2011 2010 , press enter pageload called.
i try firefox pageload called every time.
i tired write test website not same problem, found out in ie 8 changing query string same number , pressing enter pageload not called. doing in firefox makes postback fire. here test code
<%@ page title="home page" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %> <asp:content id="headercontent" runat="server" contentplaceholderid="headcontent"> </asp:content> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <h2> welcome asp.net! </h2> <p> <asp:button id="button1" runat="server" text="button" /> <asp:hyperlink id="hyperlink1" runat="server" navigateurl="~/default2.aspx?t=tt& tttttt=2010">hyperlink</asp:hyperlink> </p> <p> can find <a href="http://go.microsoft.com/fwlink/?linkid=152368&clcid=0x409" title="msdn asp.net docs">documentation on asp.net @ msdn</a>. </p> </asp:content>
navigates to
<%@ page language="c#" autoeventwireup="true" masterpagefile="~/site.master" codefile="default2.aspx.cs" inherits="default2" %> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:label id="label1" runat="server" text="label"></asp:label><asp:button id="button1" runat="server" text="button" /> </asp:content>
onload event default2.aspx
protected void page_load(object sender, eventargs e) { label1.text += "called " + datetime.now.tostring(); }
i found out problem. looks browser cache giving me problem. press f12 , cleared cache, works.
Comments
Post a Comment