Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created dynamic table row...but when i create new row,then previous textbox and dropdownlist is getting refreshed...how to solve this problem?

this is my code...:

protected void btnAdd_Click(object sender, EventArgs e)
{
Panel1.Controls.Clear();
panel1_Click = panel1_Click+1;
fnpanel1();

}

protected void fnpanel1()
{

for (int i = 0; i < panel1_Click; i++)
{
TextBox TxtBox = new TextBox();
DropDownList ddl = new DropDownList();
HiddenField hdnpanel = new HiddenField();
TxtBox.ID = "TxtBoxpanel1" + i.ToString();
ddl.ID = "ddlpanel1" + i.ToString();
hdnpanel.ID = "hnpanel1" + i.ToString();


Panel1.Controls.Add(ddl);
Panel1.Controls.Add(TxtBox);
Panel1.Controls.Add(hdnpanel);

}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900