日期:2014-05-20  浏览次数:20984 次

ASP.NET急求模态对话框传的值给模态子窗口C#程序调用~
大家好,我用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,我始终得不到,请大家出出主意~



------解决方案--------------------
---------------Father.aspx page
<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.