Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 246k

Select index changed for each loop repeat value

Jan 23 2016 2:17 AM
in this code label and text box show two time if i  select one value than it show same name labels and show two text box,,,
 
 
 
 
 
protected void ddsize_SelectedIndexChanged(object sender, EventArgs e)
{
Panel1.Visible = true;
int Count = 0;
Count++;
foreach (ListItem item in ddsize.Items)
{
if (item.Selected)
{
for (int i = 0; i < Count; i++)
{
TextBox txt = new TextBox();
Label lbl = new Label();
lbl.Text = item.Text;
Panel1.Controls.Add(lbl);
Panel1.Controls.Add(txt);
}
}
}
}

Answers (10)