tags:

views:

37

answers:

3

Hello,

I have added html controls through javascript, but when the page postback, all of the added controls are lost. Is there a way to retrieve it?

Thanks, JV

+2  A: 

They will be,if you modify the dom with javascript the modifications will not persist through a postback, whether it is static html or dynamic server side generated you will get a new page. You need to re add the controls every time.

Ben Robinson
A: 

Because the controls are dynamically added with javascript, they are supposed to vanish. If feasible, you can put them directly in your html.

Web Logic
+1  A: 

Seems like you have a couple of options. Either

  1. Add a parameter to your POST to indicate that the fields were present, then if the server sees that that parameter is set, you write the fields out in your response; or

  2. Do the form submission by AJAX, leaving your page undisturbed.

Ed Daniel
yeah this is what i did, thanks for the answer.
JV junsay