--
Parent.aspx
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function SetDate(ClientID)
{
var Url = '../modaldialog/SetDate.aspx?DialogClientID=' + ClientID;
window.open(Url, 'Calendar', 'width=335, height=170');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtDate" runat="server" onclick="SetDate(this.id)"></asp:TextBox>
</form>
</body>
Son.aspx
protected void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
if (Request.QueryString["DialogClientID"] != null)
{
string strClientID = Request["DialogClientID"].ToString().Trim();
StringBuilder sbJScript = new StringBuilder();
sbJScript.Append("window.opener.document.getElementById('" + strClientID + "').value = '" + this.Calendar1.SelectedDate.ToString("yyyy/MM/dd") + "';");
sbJScript.Append("window.close();");
ClientScript.RegisterStartupScript(this.GetType(), "ReturnValue", sbJScript.ToString(), true);
}
}
沒有留言:
張貼留言