
- 加为好友
- 发送私信
- 在线聊天
|
| 发表于:2008-04-11 14:48:215楼 得分:50 |
1楼的js正确 详细给你解释一下: 1.父页page.aspx 你的btn_searchWeb按钮如果是服务器控件,则给该按钮添加 OnClientClick="return vv()", 如果是html按钮则添加 onclick="vv()" 例如: <asp:Button ID="btn_searchWeb" runat="server" OnClientClick="return vv()"> 父页page.aspx的javascript: - JScript code
function vv()
{
var result=showModalDialog('subpage.aspx','subpage','dialogWidth:400px;dialogHeight:300px;center:yes;help:no;resizable:no;status:no'); //打开模态子窗体,并获取返回值
document.getElementById("txt_id").value=result.split("'")[0]; //返回值分别赋值给相关文本框
document.getElementById("txt_name").value=result.split("'")[1];
document.getElementById("txt_pwd").value=result.split("'")[2];
}
2.子页subpage.aspx - JScript code
function cc(infor_id,infor_name,infor_psw) //参数分别为id,name和password
{
window.returnValue= infor_id+"'"+infor_name+"'"+infor_psw; //返回值
window.close();
}
在子页的gridview的rowdatabound事件里添加代码(假设gridview的第1列是id,第2列是name,第3列是password) - C# code
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "cc('" + this.GridView1.Rows[0].Cells[0].Text + "','" + this.GridView1.Rows[0].Cells[1].Text + "','" + this.GridView1.Rows[0].Cells[2].Text + "')");
}
| | |
修改
删除
举报
引用
回复
| |