Hi, I add HTML and tags to Page dynamically. But after every postbost, all values are empty. What can I do for Solve?
+1
A:
Make sure the controls you add to the page have an ID, and that the ID is the same after posting back.
SLC
2010-06-15 09:37:33
Won't work for him. As far as I understood, he creates them with Javascript.
Max
2010-06-15 09:38:58
I saw the asp.net tag and assumed...
SLC
2010-06-15 09:39:55
No, I create HTML control ASP.NET Code Behind.I get from string and show in Literal.Literal fill in Page_Load.
Murat
2010-06-15 09:45:12
Dont work with ID.I can get value of HTML control a button click but after all values go on empty.
Murat
2010-06-15 09:59:51
+1
A:
You have to create controls in Init event of page, creating controls in Page_Load will not retain viewstat because according to control lifecycle, controls must be created before load event and just before load, the controls retrive their viewstat information. Create a new event Page_Init (make sure you write Init="Page_Init" in your first line in the Page tag). And create your controls in this event.
Akash Kava
2010-06-15 09:59:17