大家好,我用C#程序编程,父窗【控件ID号】传给模态子窗口后,我希望在模态子窗口得到父窗口id值,并在子窗口中根据该传递的id值执行查询数据的任务,我在子窗口中怎么取id值??下面程序是成功的:
MyBody.Attributes.Add("onload","document.childPage.TextBox1.value=window.parent.dialogArguments;");
结果模态子窗口TextBox1成功获得父窗口id值,我试了:Response.Write("<script language=javascript>alert('"+TextBox1.Text.ToString()+"')</script>");获取值是空的!Nothing!由此我得出结论是,asp.net模态对话框dialogArguments传的值是客户端传递的,
但我的需要是在子窗口中根据父窗口id号再次在子窗口查询,在模态子窗口用服务器端程序获得id,我始终得不到,请大家出出主意~
MyBody.Attributes.Add("onload","document.childPage.TextBox1.value=window.parent.dialogArguments;");
结果模态子窗口TextBox1成功获得父窗口id值,我试了:Response.Write("<script language=javascript>alert('"+TextBox1.Text.ToString()+"')</script>");获取值是空的!Nothing!由此我得出结论是,asp.net模态对话框dialogArguments传的值是客户端传递的,
但我的需要是在子窗口中根据父窗口id号再次在子窗口查询,在模态子窗口用服务器端程序获得id,我始终得不到,请大家出出主意~
window.location.href = 'url';可以直接在父页面把你的id传过去啊, 然后用request得到.
然后执行完成..关闭字窗口..同时就重定向父窗口..就实现了刷新
我是这么做的...其它方法就不清楚了..
<frameset rows="0,*">
<frame src="about:blank">
<frame src="childPage.aspx">
</frameset>
用二楼兄弟的话接收不了Request值,我该怎么做?应该在childPage.aspx 接收值吧?怎么做?请赐教!
(不用Session,Session是容易办到的)
<form id="father" runat="server">
<input id="Button1" type="button" value="button" onclick="javascript:window.showModalDialog('childFrame.aspx?id=fatherId');" />
</form>
---------------Commonpage.aspx.cs Page
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<FRAMESET COLS='0, *'>"+
"<FRAME SRC=''>"+
"<FRAME SRC='Child.aspx?id="+Request["id"]+
@"'></FRAMESET>");
}
---------------Child.aspx Page
protected void Page_Load(object sender, EventArgs e)
{
string a = Request["id"];
}---------------------------
Comments:
In this way, you can get the id from father page. But if the frameset is not the in specific usage, you'd better name it more commonly.
That's just what I think!
Happy new years!~everyone!