private String strName
public String Name
{
get{return strName;}
set{strName= value;}
}
This
is wrong approach,It will lose your property values. whenever
you want to get the value of Name Property it will never get in
postbacks and you will always get the Null Exception.
Right Waypublic String NameYou will retain property value of user control during postback too.
{
get
{
Object obj = ViewState["Name"];
if(obj == null)
{
return null;
}
else
{
return (String)obj;
}
}
set
{
ViewState["Name"] = value;
}
}
Tuesday, June 17, 2008
Persist the Property Values in User Controls after postbacks.
Subscribe to:
Post Comments (Atom)

2 comments:
in Set you can always add SaveViewState()
SaveViewState() in Set
Post a Comment