composite-controls

Should a DropDownList within a CompositeControl remember selected item?

Given the following public class MyControl : CompositeControl { private DropDownList myList; protected override void CreateChildControls() { base.CreateChildControls(); myList = new DropDownList(); myList.AutoPostBack = true; this.Controls.Add(myList); if (!Page.IsPostBack) {...

add the formview inside the composit control

dear friends , I created the composit control and put the formview inside that , I got this exception : Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.Table'. after set this line if (!Page.IsPostBack) _template.InstantiateIn(_fv); would you please help me to find the good solutio...

Asp Composite control child control (radiobutton) losing checked value

I am working on a quiz control in asp.net with dynamically created questions and options. The main control is basically a container to hold all of the questions. In design view users can add questions through a custom Collection Editor. Everytime i add a question to the collection editor list it generates a question tag for me. Inside ea...

Composite control creates double ids asp.net 2.0

Hi, the below Default.aspx page(code behind is given below) contains a composite control. If we assign an Id to this composite control,while page rendering it creates multiple "ID" attribute for its child controls like "". Removing obj.ID = "MyCompositeControl" creates a single id for all child controls, but we can't set our own name. Co...

Failed to load viewstate with a composite control

I have created a composite control that changes the controls in it based on the value of one of it's properties called "Type". The intent is that once this "Type" property is set, it is not changed again for the life of the control, so the controls rendered as a result of the value of the "Type" property should not change. I have overri...

Failed to load viewstate composite control

I have a composite control that contains a different set of child controls based on the value of one of it's properties at runtime. Whenever there is a postback, I get the following error: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during t...

How to save value across postbacks for a composite control without using viewstate

I have a composite control that has a couple of private fields that reference values in the cache and these private fields are called during the constructor method. Since a string key is used to identify the value in the cache, I must have a way of storing that string key in such a way that it is available at the time the control is ins...

How to save the datasource of a composite control for "reset" ability?

I have a composite control that contains a gridview. The datasource for this gridview is passed in during the composite controls' instantiation. I am currently saving this datasource to a cache twice. Once for the "currentData" and once for the "OriginalData". The composite control allows for the editing of the rows inside the gridvi...