First way by render event and viewstate:
public partial class Test1 : System.Web.UI.UserControl
{
public string CurrentValue
{
get { return (string)ViewState["CurrentValue"] ?? string.Empty; }
set { ViewState["CurrentValue"] = value; }
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write(this.CurrentValue);
}
}
{
public string CurrentValue
{
get { return (string)ViewState["CurrentValue"] ?? string.Empty; }
set { ViewState["CurrentValue"] = value; }
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write(this.CurrentValue);
}
}
Second way by HiddenField:
public int CurrentValue
{
get
{
return int.Parse(this.HiddenField1.Value.ToString());
}
set
{
this.HiddenField1.Value = value.ToString();
}
}
Render Method:
No comments:
Post a Comment