We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Runtime control in asp.net

how to add runtime controlswith data from a table on page load and its access

2 Replies

AD Administrator Syncfusion Team June 17, 2006 06:53 AM UTC

Hi Renish, I am not sure what you are trying are you just trying to create controls at runtime through code? Here is a sample code I am ataching where the control ( a textbox and a label is placed inside a panel at runtime ). You can use this code in either page_Load or Page_Init Remember because of I am using two controls I am using an another control. You can try the same in any of the controls you are in need of Control control=new Control(); TextBox textBox=new TextBox(); control.Controls.Add(textBox); Label lbl=new Label(); lbl.ForeColor=Color.Red; lbl.Text="Enter Text Here"; control.Controls.Add(lbl); this.Panel1.Controls.Add(control); Hope this helps! Regards, A.Sivakumar


AD Administrator Syncfusion Team September 29, 2006 01:43 PM UTC



>Hi Renish,
>
> I am not sure what you are trying are you just trying to create controls at runtime through code?
>
>Here is a sample code I am ataching where the control ( a textbox and a label is placed inside a panel at runtime ). You can use this code in either page_Load or Page_Init
>
>Remember because of I am using two controls I am using an another control. You can try the same in any of the controls you are in need of
>
>Control control=new Control();
>
> TextBox textBox=new TextBox();
> control.Controls.Add(textBox);
> Label lbl=new Label();
> lbl.ForeColor=Color.Red;
> lbl.Text="Enter Text Here";
> control.Controls.Add(lbl);
> this.Panel1.Controls.Add(control);
>
>Hope this helps!
>
>Regards,
>A.Sivakumar

Loader.
Live Chat Icon For mobile
Up arrow icon