I am trying to create Div dynamically on the press of button click.
For that i refered this link>> http://forums.asp.net/t/1349244.aspx
and made code on server side(.cs page) as follows>>
public static int i = 0;
protected void Button1_Click(object sender, EventArgs e)
HtmlGenericControl newControl = new HtmlGenericControl("div");
newControl.ID = "NEWControl"+i;
newControl.InnerHtml = "This is a dynamically created HTML server control.";
This code was giving me just one div each time when i press the button., I wanted to have addition of divs.
Both of these didnt work.
What mistake am i making?
Is there any thing wrong? check your page Is it getting refreshed each time?
以上就是Dynamic Div creation asp.net的详细内容，更多请关注web前端其它相关文章！