Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 243.2k

get value from dynamically created TextBoxes c#

Jan 25 2016 12:43 AM
get value from dynamically created TextBoxes by code is
txt show null value 
 
 
foreach (System.Web.UI.WebControls.ListItem item in ddsize.Items)
{
if (item.Selected)
{
TextBox txt = (TextBox)Panel1.FindControl("price"+ item.Value);
}
 
 
 
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 price = new TextBox();
price.ID = "price" + item.Value;
//txtprice.ID = "txtprice";
Label lbl = new Label();
//lbl.ID = "lblsize";
lbl.Text = item.Text;
Panel1.Controls.Add(lbl);
Panel1.Controls.Add(price);
}
}
counter++;
}
 

Answers (4)