var s = window.showModelDialog(url,window)可以使用window建立2个窗口之间的关系。详细参见 http://dotnet.aspx.cc/article/49ml4ao8-5pb3-4kny-njzd-ljoioxv4m1x4/read.aspx http://blog.csdn.net/net_lover/archive/2002/09/24/6910.aspx
<script languagel="javascript"> function ShowDialog() {
var returnValue=window.showModalDialog("dialog.aspx",null,"dialogWidth:600px;dialogHeight:400px;help:no;resizable:no;status:no;center:1;scroll:0");//获取返回值
} </script>dialog.aspx: 关闭按钮调用getValue()<script languagel="javascript"> function getValue() { var selectValue="";//获取该页面值 window.returnValue=selectValue; window.opener=null; window.close();
http://dotnet.aspx.cc/article/49ml4ao8-5pb3-4kny-njzd-ljoioxv4m1x4/read.aspx
http://blog.csdn.net/net_lover/archive/2002/09/24/6910.aspx
1.用JS写一函数,负责打开一个新窗口并返回值
2.新窗口在关闭时:window.returnValue=values;window.close();
3.在父窗口里对返回值进行处理,包括是否回发
<script languagel="javascript">
function ShowDialog()
{
var returnValue=window.showModalDialog("dialog.aspx",null,"dialogWidth:600px;dialogHeight:400px;help:no;resizable:no;status:no;center:1;scroll:0");//获取返回值
}
</script>dialog.aspx:
关闭按钮调用getValue()<script languagel="javascript">
function getValue()
{
var selectValue="";//获取该页面值
window.returnValue=selectValue;
window.opener=null;
window.close();
}
</script>
function MM_openBrWindow(theURL,winName,features)
{
window.showModalDialog(theURL,window,features);
} <asp:TextBox ID="txtCompanyName" runat="server" MaxLength="50" onblur="this.style.background='#F9F8F5'"
onfocus="this.style.background='#66FFFF'" Width="200px" ReadOnly="True"></asp:TextBox>
</td>
<td style="padding-right: 10px; padding-left: 0px; padding-bottom: 0px; padding-top: 0px; height: 80px;" align="left" >
<asp:HiddenField ID="CompanyId" runat="server" />
<asp:HiddenField ID="Hn_ID" runat="server" />
<a href="javascript:MM_openBrWindow('../ClientManager/client_list_select.aspx?type='+escape('Manufacturer'),'obj','center=yes;status=0;dialogHeight=500px;dialogWidth=728px;scroll=yes;')">
<img id="Img2" src="../../images/btn_calender.gif" value="달력" border="0" title="Select Manufacturer"/></a>打开窗体
CS代码在RowDataBound里面
DataRowView dv = (DataRowView)e.Row.DataItem;
e.Row.Attributes.Add("ondblclick", "ReturnValue('" + dv["id"] + "','" + dv["f_type"] + "')");
aspx页面代码function ReturnValue(id,val,tiaoma,size,price)
{ //给父窗体的文本框赋值 window.dialogArguments.document.getElementById('txtItemNo').value=tiaoma;//传递到添加页面的文本框里面
window.dialogArguments.document.getElementById('Hn_size').value=size;//隐藏域传递值
window.dialogArguments.document.getElementById('ID').value= id ;//传递到添加页面ID,在那里接受
self.close();
}如果你想给label在这里赋值这里的value改成innerText否则不对
href='./default.aspx?sdf=dfdf'</script>") ;