|
-
Aug 29th, 2006, 06:46 PM
#1
Thread Starter
Addicted Member
EnableViewState question
I have a question regarding viewstate..Why for the following control i get failed to load view state...This control is added dynamically..and enableviewstate is set to true. However if i comment the viewstate part it works fine.
public partial class ThmbListing : Kentico.CMS.CMSControls.InlineUserControl
{
private string sorttype = "default";
protected string SortExpression
{
get
{
object o = ViewState["SortExpression"];
if (o == null)
return string.Empty;
else
return o.ToString();
}
set
{
ViewState["SortExpression"] = value;
}
}
public string SortingOrder
{
get
{
return this.sorttype;
}
set
{
//this.Label1.Text = value;
this.sorttype = value;
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
ViewState["SortExpression"] = "hello";
Label1.Text = Convert.ToString(ViewState["SortExpression"]);
}
else
{
Label1.Text = Convert.ToString(ViewState["SortExpression"]);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|