views:

38

answers:

2

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
Won't work for him. As far as I understood, he creates them with Javascript.
Max
I saw the asp.net tag and assumed...
SLC
No, I create HTML control ASP.NET Code Behind.I get from string and show in Literal.Literal fill in Page_Load.
Murat
Dont work with ID.I can get value of HTML control a button click but after all values go on empty.
Murat
+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
Thanks, this help me.
Murat
Sorry but it dosnt work.Dynamically created Asp.Net Controls works fine but HTML tags dont works.
Murat
Is there any body help me?
Murat