Hi solve this html problem in dynamic control creation
-
Hi, My requirement is to provide tetboxes based on number selected in dropdownlist.I created instances of textboxes but while formatting it to html i m facing problem. I need to display the textboxes before a button which is given directly in design mode. while running the form, i find the textboxes coming after the button. How can i make them to align as per my req. I also need them to align to center. Please help me.I am stuck up with this problem for last few hours. :(:confused::sigh:
-
Hi, My requirement is to provide tetboxes based on number selected in dropdownlist.I created instances of textboxes but while formatting it to html i m facing problem. I need to display the textboxes before a button which is given directly in design mode. while running the form, i find the textboxes coming after the button. How can i make them to align as per my req. I also need them to align to center. Please help me.I am stuck up with this problem for last few hours. :(:confused::sigh:
-
Hi, My requirement is to provide tetboxes based on number selected in dropdownlist.I created instances of textboxes but while formatting it to html i m facing problem. I need to display the textboxes before a button which is given directly in design mode. while running the form, i find the textboxes coming after the button. How can i make them to align as per my req. I also need them to align to center. Please help me.I am stuck up with this problem for last few hours. :(:confused::sigh:
Place the controls in a Panel will serve the purpose "Aim to go where U have never been B4 and Strive to achieve it" http://groups.yahoo.com/subscribe/dotnetforfreshers http://himabinduvejella.blogspot.com
-
Hi, My requirement is to provide tetboxes based on number selected in dropdownlist.I created instances of textboxes but while formatting it to html i m facing problem. I need to display the textboxes before a button which is given directly in design mode. while running the form, i find the textboxes coming after the button. How can i make them to align as per my req. I also need them to align to center. Please help me.I am stuck up with this problem for last few hours. :(:confused::sigh:
place a panel control before the button.. add the textboxes to that panel ur problem will be solved VMSSanthosh
-
Place the controls in a Panel will serve the purpose "Aim to go where U have never been B4 and Strive to achieve it" http://groups.yahoo.com/subscribe/dotnetforfreshers http://himabinduvejella.blogspot.com
Hi, Thanks for ur answer. i cant understand where to place this panel can u please help me with some coding or reference links How to place the panel in my backend code, and how to insert the controls dynamically added to that panel. I m a bit confused over that.. Help me please..
-
The simple way to place the dynamic textboxes before the button is that you place a container like Panel, PlaceHolder ... before the button, you then add the dynamic textboxes to the container.
Hi, Thanks for ur answer. i cant understand where to place this panel can u please help me with some coding or reference links How to place the panel in my backend code, and how to insert the controls dynamically added to that panel. I m a bit confused over that.. Help me please..
-
place a panel control before the button.. add the textboxes to that panel ur problem will be solved VMSSanthosh
Hi, Thanks for ur answer. i cant understand where to place this panel can u please help me with some coding or reference links How to place the panel in my backend code, and how to insert the controls dynamically added to that panel. I m a bit confused over that.. Help me please..
-
Hi, Thanks for ur answer. i cant understand where to place this panel can u please help me with some coding or reference links How to place the panel in my backend code, and how to insert the controls dynamically added to that panel. I m a bit confused over that.. Help me please..
You don't need to add the panel dynamically just drag-it from the page then place it above the button. On page_load add this code.
TextBox dynamicTextbox1 = new TextBox();
Panel1.Controls.Add(dynamicTextbox1); -
You don't need to add the panel dynamically just drag-it from the page then place it above the button. On page_load add this code.
TextBox dynamicTextbox1 = new TextBox();
Panel1.Controls.Add(dynamicTextbox1);Hi, Thanks for ur answer, I solved my problem. :cool:
-
You don't need to add the panel dynamically just drag-it from the page then place it above the button. On page_load add this code.
TextBox dynamicTextbox1 = new TextBox();
Panel1.Controls.Add(dynamicTextbox1);Hi, i want to access the controls created dynamically, in the codebehind (ie., before its creation).I want to insert the radiobutton values into database. i cant access the controls before its creation.I am creating a some radio buttons depending on the dropdown. I tried a radiobuttonlist adding it in design time.but could not get the answer. How can i do this?
-
Hi, i want to access the controls created dynamically, in the codebehind (ie., before its creation).I want to insert the radiobutton values into database. i cant access the controls before its creation.I am creating a some radio buttons depending on the dropdown. I tried a radiobuttonlist adding it in design time.but could not get the answer. How can i do this?
There are two solutions to your problem. 1. Iterate to your container "Panel" controls collection.
//Page Load Event Handler protected void Page_Load(object sender, EventArgs e) { RadioButton radioButton = new RadioButton(); radioButton.ID = "MyRadioButton"; Panel1.Controls.Add(radioButton); } //Button Click Event Handler protected void GetMyRadioButton_Click(object sender, EventArgs e) { // Code on how to access the controls from your panel. for (Int16 i = 0; i < Panel1.Controls.Count;i++ ) { if (Panel1.Controls[i].GetType().Name == "RadioButton") { RadioButton radioButton = (RadioButton)Panel1.Controls[i]; if (radioButton.ID == "MyRadioButton") { //Put your code here } } } }
2. Use the Panel FindControl Method.
//Page Load Event Handler protected void Page_Load(object sender, EventArgs e) { RadioButton radioButton = new RadioButton(); radioButton.ID = "MyRadioButton"; Panel1.Controls.Add(radioButton); } //Button Click Event Handler protected void GetMyRadioButton_Click(object sender, EventArgs e) { // Code on how to access the controls from your panel. RadioButton radioButton = (RadioButton)Panel1.FindControl("MyRadioButton"); //Put your code here }