Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript populated data in textbox dissapears on postback

Status
Not open for further replies.

bobmm

Programmer
Nov 20, 2000
41
GB
Hi all...

I am populating a textbox from some javascript (eg document.all(detailsHREF).value = details;). When the form is submitted via postback, the serverside code cannot see the text within this control. I have played around with the viewstate settings, but cannot seem to resolve this...

Any idea's anyone????

Thank's for any help that can be offered.
 
Either make the textbox a Server control
Code:
<asp:TextBox/>
or get the value from the Request.Forms collection
Code:
Request.Form[&quot;DetailsHREF&quot;]

But - Why do you need populate the textbox using client script?

HTH


David
[pipe]
 
Thanks for the response dragonwell...

I perhaps should have made my question a litle clearer...

The textbox is a server side control (<asp:textbox runat=&quot;server&quot;> etc) .. the server side code I have pick's up the textbox.text value without problem if the textbox is directly typed into, it is only when the textbox is populated from clientside script, that a problem occurs.

The text is populated via JavaScript because it is sometimes reliant on a selection from a combo box, and to save a round trip to the server, is being modified to clientside code.

From what I have been reading to date, this problem will be down to the postback data or/and viewstate issues..

Thank's again...
[thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top