tag:blogger.com,1999:blog-6082652835152798567.post4981879502121923775..comments2024-03-28T21:41:58.974-07:00Comments on Sql server, .net and c# video tutorial: Creating controls dynamically using asp.net panel control - Part 43Unknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6082652835152798567.post-66854778329177321862020-12-11T21:44:05.831-08:002020-12-11T21:44:05.831-08:00Create a dynamic list MyArr that accept numbers th...Create a dynamic list MyArr that accept numbers through a textbox. The program should take care of the following –<br />a) When a duplicate number is entered, the program should flag an error message, stating “Duplicate number found”.<br />b) A button should be provided to clear all the elements of the list<br />c) Another button should sort the list in reverse order.<br />d) The program should provide option to delete any item from the list.<br />e) There must be option for displaying all items of the list through a loop.Sagarhttps://www.blogger.com/profile/14275359390359745094noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-10594709575839138962017-12-07T04:04:29.647-08:002017-12-07T04:04:29.647-08:00how to retrieve textbox valuehow to retrieve textbox valueAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-79557643543007392072017-10-04T10:43:44.782-07:002017-10-04T10:43:44.782-07:00using System;
using System.Collections.Generic;
us...using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.Web;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br /><br />public partial class _Default : System.Web.UI.Page<br />{<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /><br /> }<br /> protected void btnGenerateControl_Click(object sender, EventArgs e)<br /> {<br /> // Retrieve the count of the controls to generate<br /> int Count = Convert.ToInt16(txtControlsCount.Text);<br /> // Loop thru each list item in the CheckBoxList<br /> foreach (ListItem li in chkBoxListControlType.Items)<br /> {<br /> if (li.Selected)<br /> {<br /> // Generate Lable Controls<br /> if (li.Value == "Label")<br /> {<br /> for (int i = 1; i <= Count; i++)<br /> {<br /> Label lbl = new Label();<br /> lbl.Text = "Label - " + i.ToString() + "<br>";<br /> //phLabels.Controls.Add(lbl);<br /> //tdLabels.Controls.Add(lbl);<br /> pnlLabels.Controls.Add(lbl);<br /> }<br /> }<br /> // Generate TextBox controls<br /> else if (li.Value == "TextBox")<br /> {<br /> for (int i = 1; i <= Count; i++)<br /> {<br /> TextBox txtBox = new TextBox();<br /> txtBox.Text = "TextBox - " + i.ToString() ; <br /> //phTextBoxes.Controls.Add(txtBox);<br /> //tdTextBoxes.Controls.Add(txtBox);<br /><br /> pnlTextBoxes.Controls.Add(txtBox);<br /> pnlTextBoxes.Controls.Add(new LiteralControl("<br>")); <br /> //pnlTextBoxes <br /> }<br /> }<br /> // Generate Button Controls<br /> else<br /> {<br /> for (int i = 1; i <= Count; i++)<br /> {<br /> Button btn = new Button();<br /> btn.Text = "Button - " + i.ToString();<br /> //phButtons.Controls.Add(btn);<br /> //tdButtons.Controls.Add(btn);<br /> <br /> pnlButtons.Controls.Add(btn);<br /> pnlButtons.Controls.Add(new LiteralControl("<br>")); }<br /> }<br /> }<br /> }<br />}<br /> }Anonymoushttps://www.blogger.com/profile/05435588212412323284noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-4508147783251694232017-09-25T22:15:25.461-07:002017-09-25T22:15:25.461-07:00thanks for such a nice tutorial .......there is on...thanks for such a nice tutorial .......there is one question how can i add particular class on those dynamically generated textbox and can i add date picker on those text box.Anonymoushttps://www.blogger.com/profile/16722937719356554011noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-33538387154498834912012-11-25T07:13:53.902-08:002012-11-25T07:13:53.902-08:00This is by far the best video you have done. You h...This is by far the best video you have done. You have each control in its own panel but how would one program that we can add different variation of controls added dynamically in a table row like lable, text, image etc and then add the rows depending a request and also delete what is not needed. I hope you get my point.Anonymousnoreply@blogger.com