Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 243.3k

dynamic text box data insert in to database..

Jan 25 2016 4:54 AM
any body help my find control do not get text box text..
why my code is
 
 
 protected void ddsize_SelectedIndexChanged(object sender, EventArgs e)     {         if (counter > 1)             return;         foreach (ListItem item in ddsize.Items)         {             if (item.Selected)             {                                   Panel1.Visible = true;                 TextBox txtprice = new TextBox();                 txtprice.ID = "txt_price" + item.Value;                 txtprice.Width = 30;                 //txtprice.ID = "txtprice";                  Label lbl = new Label();                 //lbl.ID = "lblsize";                  lbl.Text = item.Text;                                 Panel1.Controls.Add(lbl);                 Panel1.Controls.Add(txtprice);              }         }         counter++;
 ======================
 
foreach (System.Web.UI.WebControls.ListItem item in ddsize.Items)
{
if (item.Selected)
{
string pr;
TextBox txt = (TextBox)Panel1.FindControl("txt_price");
pr = txt.Text;

Attachment: insert.rar

Answers (1)