父页面(略)
其中window.showModalDialog中第二个参数可以将父页面对象传给子页面
子页面
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
...{
if (e.Row.RowType == DataControlRowType.DataRow)
...{
e.Row.Attributes.Add("onmouseover","color = this.style.backgroundColor;this.style.backgroundColor='#0000ff';this.style.cursor='hand'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=color");
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
...{
if (e.Row.RowType == DataControlRowType.DataRow)
...{
e.Row.Attributes.Add("ondblClick ", "GetKey('" + e.Row.Cells[0].Text + "')");
}
}
function GetKet(text)
...{
//window.open
window.opener.document.getElementById("txt11").value = text;
//showModelDialog
var control = window.dialogArguments;
control.value = text;
}很简单!
这篇博客探讨了如何在GridView组件中实现双击操作,将选中行的数据回传到父页面。通过使用window.showModalDialog方法,可以将父页面的对象传递给子页面,实现实时交互。子页面的实现则相对简单。
163

被折叠的 条评论
为什么被折叠?



