Textbox clears on postback.

D

Dawie Lombaard

Please help anyone.

I have 2 aspx pages that need to "chat" to each other. The first page
is one where 2 or more dates needs to be selected from a date picker,
which is a custom form with a datepicker on that has been customised to
display public holidays. When a date is selected / the datepicker's
selected date changes I register a script block that passes the
selected date to the "window.opener.<controlname>.value".

Code:
strScript = "<script language=""javascript"">" & _
"window.opener.document.form1." &
Trim(Request.QueryString("ControlName").ToString.Trim) & ".value = '" &
Trim(Calendar1.SelectedDate.ToString("dd MMM yyyy")) & "';" & vbCrLf &
_
"window.close();" & vbCrLf & _
"</script>"

If Not IsClientScriptBlockRegistered("sendData") Then
RegisterClientScriptBlock("sendData", strScript)
End If

This works perfectly, until the next date gets selected, then the first
date gets cleared out of the textbox which was put into.

Is there any way to prevent this from happening? I assume that once the
page does a postback it resets the controls to default values?

This problem only started occuring once the project was converted from
Visual Studio 2003 to Visual Studio 2005.

Any help or suggestions will be appreciated.

TIA.

Dawie Lombaard.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top