Ask a Question related to ASP.NET General, Design and Development.
-
Mark Sisson #1
Missing Viewstate in Custom Control
Easy one for gurus::::
Could someone tell me why this custom control bombs during postback?
To duplicate: compile this control, put it in your toolbox, drag it to
a new form, add a button to the form, run the form, hit the button.
Voila! The control doesn't remember it's ViewState.
WHY!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tia
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace ViewStateTestControl
{
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 :
System.Web.UI.WebControls.WebControl, INamingContainer
{
public WebCustomControl1()
{
this.EnableViewState = true;
}
protected override void Render(HtmlTextWriter output)
{
if (!Page.IsPostBack) ViewState["a"] = "a";
output.Write(ViewState["a"].ToString());
}
}
}
Mark Sisson Guest
-
viewstate and custom control
I have custom control with dropdownlist. I am using this custom control in a repeater. After the post-back the control properties that i stored in... -
Nested control in Web Custom Control and ViewState
I am working on a Web Custom Control that will function as a Tab menu. I am having problems with figuring out what I need to do to link up the... -
Missing ID property for a custom control
Hello, When i'm using a custom control in my project, i can see that the custom control is missing it's ID in the HTML file. I can see the object... -
Custom control viewstate (?) issue!
I've been struggling for a day and yet haven't found a solution to such a problem: I have, let's say, an apsx page, which contains a UserControl,... -
Losing viewstate in custom control
I have a custom control I derived from the datagrid control and set a couple of values in viewstate("foo") = "bar" but on postback they are...



Reply With Quote

