Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 241.5k

find null value dynamic textbox

Jan 25 2016 11:39 PM
 please solve my problem
 
first i create text box...
 
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;
Label lbl = new Label();
lbl.Text = item.Text;
Panel1.Controls.Add(lbl);
Panel1.Controls.Add(txtprice);
}
}
counter++;
 
 
 
 
 
and then find that id in another forachloop...code is
 
 
foreach (ListItem item in ddsize.Items)
{
if (item.Selected)
{
TextBox text = (TextBox)Panel1.FindControl("txt_price" + item.Value);
}
 
 
 
 
 
 
 
 

Answers (3)