Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to get IDs (and of course value) of controls added dynamically
    primarykey
    data
    text
    <p>I am just trying to add some dynamic controls to the SimpleQueryControl (which of course is a kind of Web Control and inherits all the methods accordingly). I dont know how to get the values of Child controls which I have added dynamically.</p> <pre><code>class RoomPickerQueryControl : SimpleQueryControl { protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { EnsureChildControls(); mColumnList.Visible = false; } } protected override void OnInit(EventArgs e) { DateTimeControl controlStartDate = new DateTimeControl(); controlStartDate.LocaleId = 1053; controlStartDate.CssClassTextBox = "ms-long"; controlStartDate.TimeZoneID = 1053; controlStartDate.LocaleId = 1053; controlStartDate.MinDate = DateTime.Now; controlStartDate.ID = "startDateTime"; controlStartDate.Visible = true; controlStartDate.Enabled = true; controlStartDate.EnableViewState = true; this.Controls.Add(controlStartDate); base.OnInit(e); } protected override void CreateChildControls() { base.CreateChildControls(); } protected override int IssueQuery(string search, string groupName, int pageIndex, int pageSize) { //i'm unable to get the ids here DateTimeControl dt = (DateTimeControl) FindControlRecursive(this, "startDateTime"); //i'm unable to get the ids here DateTimeControl dt3 = (DateTimeControl)FindControlRecursive(this.Page, "startDateTime"); //i'm unable to get the ids here DateTimeControl controlStartDate = (DateTimeControl)this.FindControl("startDateTime"); //i'm unable to get the ids here DateTimeControl controlEndDate = (DateTimeControl)this.FindControl("endDateTime"); return rowCount; } public static Control FindControlRecursive(Control Root, string Id) { if (Root.ID == Id) return Root; foreach (Control Ctl in Root.Controls) { Control FoundCtl = FindControlRecursive(Ctl, Id); if (FoundCtl != null) return FoundCtl; } return null; } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload