C
Christian
Hi,
I have a Webform with 1 submit button and 1 label
code behind :
public class MainWebForm: System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblFName;
protected override void LoadViewState( object o )
{
lblFName.Text = (string)ViewState["FName"];
}
protected override object SaveViewState()
{
ViewState["FName"] = "Enter First Name Here";
return base.SaveViewState();
}
}
Upon loading the page the first time
- LoadViewState() is not executed yet : OK
- SaveViewState() event is executed and saves a value in
the ViewState-object :OK
Page is now displayed with an empty label : OK
Upon pressing the Submit button : page loads a second time
- LoadViewState() is executed and ViewState["FName"] is still empty ????
Why ?
Thanks
Chris
I have a Webform with 1 submit button and 1 label
code behind :
public class MainWebForm: System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblFName;
protected override void LoadViewState( object o )
{
lblFName.Text = (string)ViewState["FName"];
}
protected override object SaveViewState()
{
ViewState["FName"] = "Enter First Name Here";
return base.SaveViewState();
}
}
Upon loading the page the first time
- LoadViewState() is not executed yet : OK
- SaveViewState() event is executed and saves a value in
the ViewState-object :OK
Page is now displayed with an empty label : OK
Upon pressing the Submit button : page loads a second time
- LoadViewState() is executed and ViewState["FName"] is still empty ????
Why ?
Thanks
Chris