How to persist asp.net control values set via JavaScript

D

David Adams

Hi,

I have a web form that opens a pop-up page that sets a textbox control on
the parent page based on modifications made in the pop-up. I am using the
following code as an example.

window.opener.document.getElementById(''myParentTextBox').value=document.getElementById("myPopUpTextBox").value


The value is set in the parent perfectly, but when I postback to the server
it only contains the value the page was loaded with.

Is there a way to overcome this and store the value that was written from JS
in the pop-up?

Thanks,
David
 
G

Guest

You don't give much information there, but I'll take a shot anyway. Typical
causes of losing the data on postback are from re-assigning the value in your
Page_Load before you try to read it. Look through your code, and don't
forget the hidden OnInit method, for places where your code is assigning the
value on PostBack. Make sure that any assignments are done within an if
(!IsPostBack) section.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top