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
OnInitevent, tryPreLoadevent instead.