Thanks for your response, I did that & response.wrote now.ToString(). What
i've found is that the time was written the 1st time the aspx was shown but
always showed the same time in each following load (Probably something to do
with caching i guess?) Note: the aspx page is loaded by assignment (client
side) to the src property at run time - but within a .htm file - inside a
Modal dialog! Not sure how the page_load isnt called 2nd, 3rd time.
CODE...
*** Main.aspx (inside Page_Load)***
Button1.Attributes.Add("onclick", "var
strReturn=window.showModalDialog('popup.htm','popup.aspx?v1=" &
txtStartDate.Text & "','status:no;
dialogWidth:250px;dialogHeight:250px;dialogHide:true;help:no;scroll:no'); if
(strReturn) document.forms[0].txtStartDate.value=strReturn;")
Button2.Attributes.Add("onclick", "var
strReturn=window.showModalDialog('popup.htm','popup.aspx?v1=" &
txtEndDate.Text & "','status:no;
dialogWidth:250px;dialogHeight:250px;dialogHide:true;help:no;scroll:no'); if
(strReturn) document.forms[0].txtEndDate.value=strReturn;")
*** Popup.htm ***
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>popup</title>
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="ProgId" content="VisualStudio.HTML">
<meta name="Originator" content="Microsoft Visual Studio.NET 7.0">
<script language='javascript'>
//<!--
function load()
{
var src = window.dialogArguments;
if (src) {
document.all.Frame1.src = src;
}
}
//-->
</script>
</head>
<body onload='load()' MS_POSITIONING="GridLayout">
<iframe id="Frame1" height='100%' width='100%' style="OVERFLOW: auto;
BACKGROUND-COLOR: blue">
</iframe>
</body>
</html>
*** popup.aspx.vb ***
Imports System.Web.UI.HtmlControls.HtmlGenericControl
Public Class PopUp
Inherits System.Web.UI.Page
Protected WithEvents calDate As System.Web.UI.WebControls.Calendar
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If IsPostBack = False Then
If (Request.QueryString("v1") & "") <> "" Then
If Microsoft.VisualBasic.IsDate(Request.QueryString("v1").ToString()) Then
calDate.SelectedDate = CDate(Request.QueryString("v1").ToString())
calDate.VisibleDate = calDate.SelectedDate
End If
End If
End If
End Sub
Private Sub calDate_SelectionChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles calDate.SelectionChanged
AddClientScript()
End Sub
Private Sub AddClientScript()
Dim strScript As String = "<script>"
strScript &= "window.returnValue='" &
calDate.SelectedDate.ToString("dd-MMM-yyyy") & "';"
strScript &= "window.close()"
strScript &= "</" & "script>"
RegisterClientScriptBlock("anything", strScript)
End Sub
End Class
*** popup.aspx ***
<%@ Page Language="vb" AutoEventWireup="false" Src="PopUp.aspx.vb"
Inherits="PopUp" smartNavigation="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PopUp</title>
<base target="_self">
<meta url="popup.aspx">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="
http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body onload="window.focus()" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" target="_self" runat="server">
<asp:calendar id="calDate" Runat="server" BackColor="White" Width="100%"
DayNameFormat="FirstLetter" ForeColor="Black" Height="100%" Font-Size="8pt"
Font-Names="Verdana" BorderColor="#999999" CellPadding="4">
<TodayDayStyle ForeColor="Black" BackColor="#CCCCCC"></TodayDayStyle>
<SelectorStyle BackColor="#CCCCCC"></SelectorStyle>
<NextPrevStyle VerticalAlign="Bottom"></NextPrevStyle>
<DayHeaderStyle Font-Size="7pt" Font-Bold="True"
BackColor="#CCCCCC"></DayHeaderStyle>
<SelectedDayStyle Font-Bold="True" ForeColor="White"
BackColor="#666666"></SelectedDayStyle>
<TitleStyle Font-Bold="True" BorderColor="Black"
BackColor="#999999"></TitleStyle>
<WeekendDayStyle BackColor="#FFFFCC"></WeekendDayStyle>
<OtherMonthDayStyle ForeColor="#808080"></OtherMonthDayStyle>
</asp:calendar>
</form>
</body>
</HTML>