c# - How to get rid of the view state caching for ASP.NET page -
i make dynamic table in code behind file using code such:
<table border="0" cellpadding="4" cellspacing="0"> <asp:placeholder id="placeholder1" enableviewstate="false" runat="server"></asp:placeholder> </table>
and here's how build in page_load():
system.web.ui.htmlcontrols.htmlgenericcontrol trcontainer0 = new system.web.ui.htmlcontrols.htmlgenericcontrol("tr"); system.web.ui.htmlcontrols.htmlgenericcontrol tdcontainer00 = new system.web.ui.htmlcontrols.htmlgenericcontrol("td"); //time variable datetime dtdatetime0 = datetime.now(); //time (must localized) textbox tbxattime = new textbox(); tbxattime.enableviewstate = false; tbxattime.id = "mytime1"; tbxattime.text = dtdatetime0.toshorttimestring(); tdcontainer00.controls.add(tbxattime); trcontainer0.controls.add(tdcontainer00); placeholder1.controls.add(trcontainer0);
this loads tbxattime
text box correctly, problem happens when change culture custom control on page makes load (via post-back.) in case tbxattime
text box seems retain old value got during initial loading of page, though when put break-point in code, shows new text (with accordance new culture.)
so what's trick here?
Comments
Post a Comment