Hi,
I need to create dynamic controls on button click.
HTML:
CODE:
When clicked on AddSorting shown in the below image I am trying to create dropdown control using below code and the controls doesn't show.
protected void lnkAddSort_Click(object sender, EventArgs e)
{
int index = pnlSort.Controls.OfType().ToList().Count + 1;
this.Createddl("ddldyn" + index);
}
public void Createddl(string id)
{
DropDownList ddl = new DropDownList();
ddl.ID = id;
pnlSort.Controls.Add(ddl);
Literal lt = new Literal();
lt.Text = "
";
pnlSort.Controls.Add(lt);
}
Can anyone please provide suggestions on how to handle this?