Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
Iam created dynamic txtbox,dropdownlist and button also.Now i want save those values in database.
Posted 13-Mar-12 18:47pm
Comments
Mantu Singh at 14-Mar-12 0:51am
   
please clarify more.....?
Hari Krishna Prasad Inakoti at 14-Mar-12 1:06am
   
Table table = new Table(); table.ID = "tbl_dy"; DropDownList ddl = new DropDownList(); Page.Form.Controls.Add(table); if (!IsPostBack) { for (int i = 1; i < 3; i++) { TableRow row = new TableRow(); TableCell cell = new TableCell(); Label lbl = new Label(); lbl.ID = "lbl_'" + i + "'"; if (i == 1) { lbl.Text = "Name"; } else { lbl.Text = "Salary"; } cell.Controls.Add(new LiteralControl("  ")); TextBox txt = new TextBox(); txt.ID="txt_'"+i+"'"; cell.Controls.Add(new LiteralControl("<br/>")); cell.Controls.Add(lbl); cell.Controls.Add(txt); row.Cells.Add(cell); table.Rows.Add(row); } TableRow row1 = new TableRow(); TableCell cell1 = new TableCell(); Label lbl1 = new Label(); lbl1.ID = "lbl_gender"; lbl1.Text = "Gender"; ddl.Width = 180; ddl.Height = 25; ddl.ID = "ddl_gender"; ddl.Items.Add("Select"); ddl.Items.Add("Male"); ddl.Items.Add("Female"); cell1.Controls.Add(lbl1); cell1.Controls.Add(new LiteralControl("  ")); cell1.Controls.Add(ddl); row1.Cells.Add(cell1); table.Rows.Add(row1); } }
Nilesh Patil Kolhapur at 14-Mar-12 0:53am
   
hari give some code
Hari Krishna Prasad Inakoti at 14-Mar-12 1:06am
   
Table table = new Table(); table.ID = "tbl_dy"; DropDownList ddl = new DropDownList(); Page.Form.Controls.Add(table); if (!IsPostBack) { for (int i = 1; i < 3; i++) { TableRow row = new TableRow(); TableCell cell = new TableCell(); Label lbl = new Label(); lbl.ID = "lbl_'" + i + "'"; if (i == 1) { lbl.Text = "Name"; } else { lbl.Text = "Salary"; } cell.Controls.Add(new LiteralControl("  ")); TextBox txt = new TextBox(); txt.ID="txt_'"+i+"'"; cell.Controls.Add(new LiteralControl("<br/>")); cell.Controls.Add(lbl); cell.Controls.Add(txt); row.Cells.Add(cell); table.Rows.Add(row); } TableRow row1 = new TableRow(); TableCell cell1 = new TableCell(); Label lbl1 = new Label(); lbl1.ID = "lbl_gender"; lbl1.Text = "Gender"; ddl.Width = 180; ddl.Height = 25; ddl.ID = "ddl_gender"; ddl.Items.Add("Select"); ddl.Items.Add("Male"); ddl.Items.Add("Female"); cell1.Controls.Add(lbl1); cell1.Controls.Add(new LiteralControl("  ")); cell1.Controls.Add(ddl); row1.Cells.Add(cell1); table.Rows.Add(row1); } }
SAKryukov at 14-Mar-12 1:28am
   
Hari Krishna, please move your comments with code to the question itself, use "Improve question". This is because there you can format it using "pre" tags. I also could make a special code sample, more compact, using only relevant detail, just to make the problem more clear. --SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check the Google link[^]. If you have already tried something, share some code; else try some links first.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

foreach(Control c in this.Controls)
{
Textbox tb = c as Textbox;
 
string val = tb.Text;
}
  Permalink  
Comments
SathyaRaju at 14-Oct-13 0:45am
   
how to find dynamic text position in c# windows application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 460
1 Sergey Alexandrovich Kryukov 336
2 Shai Vashdi 294
3 OriginalGriff 280
4 Abhinav S 160
0 Sergey Alexandrovich Kryukov 9,185
1 OriginalGriff 5,315
2 Peter Leow 4,040
3 Maciej Los 3,535
4 Abhinav S 3,308


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 14 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid