Pop-up Calendar with masterpage

  • Thread starter Thread starter warrengo
  • Start date Start date
W

warrengo

I have a 2.0 asp app and i'm trying to implement a pop-up calendar. I
can get the calendar to pop-up and select a value, but can not get the
value to pass back to the calling page. Here is the code i'm using:

code linked to an html button

function Button5_onclick(evt) {
//OBTAIN CURRENT X-Y POSITION
var CurX = parseInt(evt.x);
var CurY = parseInt(evt.y);


window.open('calendar.aspx?contentname=document.forms[0].elements[' +
'<%= lblDate.ClientID %>' +
']','cal','width=164,height=188').moveTo(CurX,
CurY);//calendar.focus();

//window.open('calendar.aspx?contentname=ContentPlaceHolder1$lblDate','cal','width=164,height=188').moveTo(CurX,
CurY);//calendar.focus();
}


Code on the pop-up window

Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs)
Dim strjscript As String = "<script language=""javascript"">"
strjscript &= "window.opener." &
HttpContext.Current.Request.QueryString("contentame") & _
".value = '" & Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</scr" & "ipt>"
Literal1.Text = strjscript
End Sub

Thanks for any help.
 
if your popup window does a postback, this causes a render. in the new
rendered page, opener will no longer references the parent page, and there
is no way to access it.

if you need to postback, the popup should be a frameset, with the postback
page in the frame. then on postback it can access the frameset and its
opener. (parent.opener)

-- bruce (sqlwork.com)
 
Back
Top