| textbox1 | textbox1 |
add more
when user click on add more two more textbox generated. if again click two more textbox generated and more.
please help .
thanks
| textbox1 | textbox1 |
Know the answer? Post it. Somebody with the same question will find it here.
Jitendra KumarRank #760 · 3K reputationPosted Mar 1, 2015, 6:51 PM EST
http://www.dotnettips4u.com/2013/03/dynamically-creating-text-boxes-using-c.html
http://geekswithblogs.net/dotNETvinz/archive/2009/03/17/dynamically-adding-textbox-control-to-aspnet-table.aspx
http://www.dotnetpickles.com/2014/02/cnet-dynamically-create-textbox-in.html
Hussain AhmedRank #1,271 · 1.4K reputationPosted Mar 1, 2015, 6:59 PM EST
http://www.c-sharpcorner.com/Blogs/15535/generate-textbox-dynamically-at-runtime-in-windows-form-appl.aspx
Jitendra KumarRank #760 · 3K reputationPosted Mar 1, 2015, 7:35 PM EST
keyurRank #5,481 · 298 reputationPosted Mar 1, 2015, 7:46 PM EST
Can you please tell me more about your problem ? what are you using winforms,webforms ?
what control are you using ?
Thanks
Keyur
Rajeev KumarRank #1,937 · 758 reputationPosted Mar 1, 2015, 9:21 PM EST
keyurRank #5,481 · 298 reputationPosted Mar 1, 2015, 10:19 PM EST
Can you please check below link
http://www.codeproject.com/Articles/467788/Dynamically-adding-and-deleting-rows-from-ASP-NET
hope this will help you
Rajeev KumarRank #1,937 · 758 reputationPosted Mar 2, 2015, 1:00 AM EST
Jitendra KumarRank #760 · 3K reputationPosted Mar 2, 2015, 2:31 AM EST
Rajeev KumarRank #1,937 · 758 reputationPosted Mar 2, 2015, 2:43 AM EST
");
{
// Fetch the number of Rows and Columns for the table
// using the properties
int tblRows =1;
int tblCols = 2;
// Now iterate through the table and add your controls
for (int i = 0; i < tblRows; i++)
{
TableRow tr = new TableRow();
for (int j = 0; j < tblCols; j++)
{
TableCell tc = new TableCell();
TextBox txtBox = new TextBox();
txtBox.ID = "txt-" + i.ToString() + "-" + j.ToString();
txtBox.Text = "RowNo:" + i + " " + "ColumnNo:" + " " + j;
tc.Controls.Add(txtBox);
tr.Cells.Add(tc);
}
Table1.Rows.Add(tr);
Table1.EnableViewState = true;
ViewState["Table1"] = true;
}
}
sumit kumar131 reputationPosted Mar 2, 2015, 10:29 PM EST
and this is the code-behind code:
Rajeev KumarRank #1,937 · 758 reputationPosted Mar 2, 2015, 11:44 PM EST
sapana sharma4 reputationPosted Mar 3, 2015, 1:54 AM EST
private void button1_Click(object sender, EventArgs e)
{
TextBox txtRun = new TextBox();
txtRun.Name = "txtDynamic"+c++;
txtRun.Location = new System.Drawing.Point(20, 18+(20*c));
txtRun.Size = new System.Drawing.Size(200, 25);
this.Controls.Add(txtRun);
}
Hope this helps, if this solves your problem
sumit kumar131 reputationPosted Mar 3, 2015, 2:55 AM EST
Keertti Raj Thangavelu BabuRank #3,979 · 374 reputationPosted Mar 18, 2015, 9:07 PM EDT
Please check the following link:
http://www.c-sharpcorner.com/UploadFile/3db540/creating-validating-reading-dynamic-textbox-in-Asp-Net/
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts