This is working (sort of), but there is an issue. I don't want to render the WebDateSelector control until I call it via the controls Render() override: mDateChooser.RenderControl(writer). I am rendering these controls inside a row that is being added to a table in the parent container control. Why is it rendering when I add it to the pages child controls?
Page: GridParameters.aspx
Page_Load()
{
mParamControlList = new ParamControlList(mSql);
mHolder.Controls.Add(mParamControlList);
}
WebControl: ParamControlList.cs
ParamControlList() constructor
{
ParamControl pc = new ParamControl(param);
this.Controls.Add(pc);
}
Render() override:
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(WebDashboard.ParamControl))
c.RenderControl(writer);
}
WebControl ParamControl.cs:
Constructor:
mDateChooser = new Infragistics.WebUI.WebSchedule.WebDateChooser();
mDateChooser.ID = string.Format("mDateChooser_{0}", this.Parameter.IteratorValue);
mDateChooser.Format = Infragistics.WebUI.WebSchedule.DateFormat.Short;
CreateChildControls() override:
this.Controls.Add(mDateChooser); <-- this renders the control. I only want it added to the page, not rendered yet.
Render() override:
writer.RenderBeginTag(HtmlTextWriterTag.Td);
mDateChooser.RenderControl(writer); <-- This renders a non-usable WebDateChooser
writer.RenderEndTag();
-------------------------------------------------------------------------------------------------------------------
Obviously I am missing something, but can't see it.