Ask a Question related to ASP.NET General, Design and Development.
-
Tarang Deshpande #1
Creating Form Controls at Run-Time
I would like to be able to create controls at run-time
rather than at design time. Is there a function that I
can override so that I can output the appropriate html
code between when the <body> and </body> tags are outputed.
I don't have to have web form controls but could just be
plain html controls.
Thanks
Tarang Deshpande Guest
-
Control.Controls bug? Control's child controls missing at the run time.
Hello, ..NET 1.1/VB.NET: I have a custom web control Public Class DatePicker Inherits Control Implements INamingContainer -
flash form: how to align form controls in table manner
Lets say that we have three columns and two rows and each cell have an input. I can align the inputs vertically using html table. How do I do it the... -
need form controls list at design time
Hello, I have created a server control and would like to have one of my properties have a drop down list with the controls on the current page as... -
Creating a emialed web form help needed big time
Hi Folks, I'm new to flash 2 days but have managed to create a responce form for my small site at apple, the form is filled in then I want the... -
Creating form with tab controls
Hi, I created about 5 forms (custumors, invoices, ....) I would like to use now the access2 tab control form to switch between these forms. I was... -
Natty Gur #2
Re: Creating Form Controls at Run-Time
You can create server controls or Html controls at the page_load event.
you can also attach them to events :
System.Web.UI.WebControls.ListBox oLst = new
System.Web.UI.WebControls.ListBox();
oLst.Enabled = true;
oLst.EnableViewState = true;
oLst.ID = "cboDevQueueList";
oLst.AutoPostBack = true;
oLst.Items.Add ("a");
oLst.Items.Add ("b");
oLst.Visible = true;
oLst.SelectedIndexChanged += new System.EventHandler(this.SelItem);
// ad the control inside the form
("WebForm6").Controls.Add(oLst);
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Tarang Deshpande #3
Re: Creating Form Controls at Run-Time
How about if you want to create html controls rather than
web controls what do you do? I tried using Response.Write
during the Page_Load but that only puts the html code
before everything else from the ASPX page.
page_load event.>-----Original Message-----
>You can create server controls or Html controls at the(this.SelItem);>you can also attach them to events :
>
>System.Web.UI.WebControls.ListBox oLst = new
>System.Web.UI.WebControls.ListBox();
>oLst.Enabled = true;
>oLst.EnableViewState = true;
>oLst.ID = "cboDevQueueList";
>oLst.AutoPostBack = true;
>oLst.Items.Add ("a");
>oLst.Items.Add ("b");
>oLst.Visible = true;
>oLst.SelectedIndexChanged += new System.EventHandler***>// ad the control inside the form
>("WebForm6").Controls.Add(oLst);
>
>Natty Gur, CTO
>Dao2Com Ltd.
>28th Baruch Hirsch st. Bnei-Brak
>Israel , 51114
>
>Phone Numbers:
>Office: +972-(0)3-5786668
>Fax: +972-(0)3-5703475
>Mobile: +972-(0)58-888377
>
>Know the overall picture
>
>
>*** Sent via Developersdex [url]http://www.developersdex.com[/url]>Don't just participate in USENET...get rewarded for it!
>.
>Tarang Deshpande Guest
-
Natty Gur #4
Re: Creating Form Controls at Run-Time
The same way and location just use Html control classes:
System.Web.UI.HtmlControls.HtmlInputText o = new
System.Web.UI.HtmlControls.HtmlInputText ();
o.Value = "natty";
o.Visible = true;
this.FindControl("WebForm6").Controls.Add(o);
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Joao S Cardoso [MVP] #5
Re: Creating Form Controls at Run-Time
Mind that if you are creating WebControls and you whant to preserve viewstate,
the controls must be created on Page_Init.
regards
Joao Cardoso (MVP dotNET)
================================================== =====
[LusoCoders]- [url]http://groups.yahoo.com/group/lusocoders/[/url]
[PontoNetPT]- [url]http://www.programando.net/regras.aspx[/url]
[email]jjscc@acinet.pt.nosp[/email]am - [url]www.acinet.pt[/url]
================================================== =====
Joao S Cardoso [MVP] Guest
-
Tarang Deshpande #6
Re: Creating Form Controls at Run-Time
This doesn't quite work. I added label controls and if
you look at the gnerated html code at the client the end
result is rendered after the </HTML> tag and thus outside
of the form. Also each label was between <span></span>
tags.
page_load event.>-----Original Message-----
>You can create server controls or Html controls at the(this.SelItem);>you can also attach them to events :
>
>System.Web.UI.WebControls.ListBox oLst = new
>System.Web.UI.WebControls.ListBox();
>oLst.Enabled = true;
>oLst.EnableViewState = true;
>oLst.ID = "cboDevQueueList";
>oLst.AutoPostBack = true;
>oLst.Items.Add ("a");
>oLst.Items.Add ("b");
>oLst.Visible = true;
>oLst.SelectedIndexChanged += new System.EventHandler***>// ad the control inside the form
>("WebForm6").Controls.Add(oLst);
>
>Natty Gur, CTO
>Dao2Com Ltd.
>28th Baruch Hirsch st. Bnei-Brak
>Israel , 51114
>
>Phone Numbers:
>Office: +972-(0)3-5786668
>Fax: +972-(0)3-5703475
>Mobile: +972-(0)58-888377
>
>Know the overall picture
>
>
>*** Sent via Developersdex [url]http://www.developersdex.com[/url]>Don't just participate in USENET...get rewarded for it!
>.
>Tarang Deshpande Guest
-
Natty Gur #7
Re: Creating Form Controls at Run-Time
Sorry, I have mistake at this line :>("WebForm6").Controls.Add(oLst);
this.controls["YourFormName"].Controls.Add(oLst);
you need to use the right Controls collection to add your control to.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest



Reply With Quote

