c# - How to delete dynamically created textbox in asp.net -
i have created code adding textbox not know delete added textbox.
share me how remove textbox;
counter ++; textbox tb = new textbox(); tb.id = "textbox" +counter; literalcontrol linebreak = new literalcontrol(); placeholder1.controls.add(tb); placeholder1.controls.add(linebreak); controlidlist.add(tb.id); viewstate["controlidlist"] = controlidlist;
you can remove textbox placeholder below:
protected void remove(object sender, eventargs e) { foreach (control control in placeholder1.controls) { //here need take id viewstate["controlidlist"] if (control.id == "takeidfromcontrollistsid") { controls.remove(control); } } }
Comments
Post a Comment