viewstate not work and not disable it
property curRefID:
public string curRefID
{
get
{
return ViewState ["curid"] as string;
}
set
{
ViewState ["curid"] = value;
}
开发者_运维技巧 }
I init it in method InitUCControl()
protected override void OnInit ( EventArgs e )
{
base.OnInit ( e );
if ( !IsPostBack )
{
InitUCControl ( );
}
}
and then i want use the property in a button click event, it always return null. but it had a value when i debug it in InitUCControl(). I don't know why it can't work...so weird. ps:I didn't disable viewstate .in page's html source code viewstate can be found.
According to MSDN viewstate isn't available in OnInit
event, try PreLoad
event instead.
精彩评论