setting viewstate postback


i am perplexing set viewstate-variable symbol pressed, nonetheless wholly works second i click button. here code-behind:



protected vacant page_load(object sender, eventargs e)
{
(page.ispostback)
{
lblinfo.innertext = string.format("hello {0} during {1}!", yourname, datetime.now.tolongtimestring());
}
}

private twine yourname
{
{ relapse (string)viewstate["yourname"]; }
set { viewstate["yourname"] = value; }
}


protected vacant btnsubmit_click(object sender, eventargs e)
{
yourname = txtname.text;

}


is there something i am missing? here form-part design-file, unequivocally simple only poc:



<form id="form1" runat="server">
<div>
enter your name: <asp:textbox runat="server" id="txtname"></asp:textbox>
<asp:button runat="server" id="btnsubmit" text="ok" onclick="btnsubmit_click" />
<hr />
<label id="lblinfo" runat="server"></label>
</div>
</form>


ps: illustration unequivocally simplified, "use txtname.text instead viewstate" repremand answer, i need info viewstate.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?