| 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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Keertti Raj Thangavelu BabuPosted Mar 19, 2015, 1:07 AM
Please check the following link:
http://www.c-sharpcorner.com/UploadFile/3db540/creating-validating-reading-dynamic-textbox-in-Asp-Net/
sumit kumarPosted Mar 3, 2015, 7:55 AM
sapana sharmaPosted Mar 3, 2015, 6:54 AM
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
Rajeev KumarPosted Mar 3, 2015, 4:44 AM
sumit kumarPosted Mar 3, 2015, 3:29 AM
and this is the code-behind code:
Rajeev KumarPosted Mar 2, 2015, 7:43 AM
");
{
// 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;
}
}
Jitendra KumarPosted Mar 2, 2015, 7:31 AM
Rajeev KumarPosted Mar 2, 2015, 6:00 AM
keyurPosted Mar 2, 2015, 3:19 AM
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 KumarPosted Mar 2, 2015, 2:21 AM
keyurPosted Mar 2, 2015, 12:46 AM
Can you please tell me more about your problem ? what are you using winforms,webforms ?
what control are you using ?
Thanks
Keyur
Jitendra KumarPosted Mar 2, 2015, 12:35 AM
Hussain AhmedPosted Mar 1, 2015, 11:59 PM
http://www.c-sharpcorner.com/Blogs/15535/generate-textbox-dynamically-at-runtime-in-windows-form-appl.aspx
Jitendra KumarPosted Mar 1, 2015, 11:51 PM
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