help please

bary40

Newcomer
Joined
Nov 9, 2003
Messages
17
Hi,

I currently have a web usercontrol (editcalendar.ascx) which is loaded into a webform (default.aspx). On the usercontrol is a textbox called txtStartDate and a button. On click of the button open another form name popup.aspx

How do I reference the textbox from the popup.aspx

window.opener.document.forms[0].txtStartDate.value = 'Test'

thanks in advance
 
bary40 said:
Hi,

I currently have a web usercontrol (editcalendar.ascx) which is loaded into a webform (default.aspx). On the usercontrol is a textbox called txtStartDate and a button. On click of the button open another form name popup.aspx

How do I reference the textbox from the popup.aspx

window.opener.document.forms[0].txtStartDate.value = 'Test'

thanks in advance


here is some vb code that I used to do what you are trying to do:
Visual Basic:
dim sTest as string = "test"

Response.Write("<script language=""javascript"">")
Response.Write("try{ window.opener.document.forms[0].txtStartDate.value='" + sTest + "';}" + _
    " catch (ex){alert(ex.description);}")
Response.Write("self.close();")
Response.Write("</script>")
 
bary40 said:
Hi,

I currently have a web usercontrol (editcalendar.ascx) which is loaded into a webform (default.aspx). On the usercontrol is a textbox called txtStartDate and a button. On click of the button open another form name popup.aspx

How do I reference the textbox from the popup.aspx

window.opener.document.forms[0].txtStartDate.value = 'Test'

thanks in advance
how are you opening popup.aspx? via window.ShowModalDialog ?
your user control should register a script block for opening the window. use the UniqueID property of the text box in the script to pass the rendered input element to the opened document as one of the arguments of the window.ShowModalDialog method. The opened document wrties to it via the window.dialogArguments property using javascript.

make sense???
 
Back
Top