主页面的代码:
protected void Page_Load(object sender, EventArgs e)
{
this.TextBox1.Attributes["onClick"] = "UseOpenner()";
}
//主页面的源中
<SCRIPT LANGUAGE="JavaScript">
<!--
function UserOpenner()
{
var returnValue = window.showModalDialog("ShowTree.htm","A","dialogWidth=306px;dialogHeight=345px");
if (returnValue != "点击")
document.all.TextBox1.value = returnValue ;
}
//-->
</SCRIPT>
// ShowTree.htm
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>点击部门名称</title>
</head>
<body>
<iframe name ="treeframe" marginheight=0 marginwidth =0 height ='300' scrolling = auto frameborder=0 width='300' src ='EM_Showwindow.aspx' ></iframe>
</body>
</html>
//'EM_Showwindow.aspx' 页面中
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
string cc = this.TreeView1.SelectedNode.Value;
this.RegisterStartupScript("ST", "<script language='javascript'>\nparent.window.returnValue = '" + cc + "';\nparent.window.close();\n</script>");
}
protected void RadioButtonList1_DataBound(object sender, EventArgs e)
{
//上级部门名称
for (int i = 0; i < this.RadioButtonList1.Items.Count; i++)
{
this.RadioButtonList1.Items[i].Attributes.Add("onclick", "Show()");
}
}
//'EM_Showwindow.aspx' 页面.源中
!--
<SCRIPT LANGUAGE="JavaScript">
<!--
function Show()
{
var rdo = document.all.RadioButtonList1;
for (i=0; i<rdo.length; i++)
{
if (rdo[i].checked)
{
selectedIndex = i;
window.returnValue = rdo[i].value;
window.close();
break;
}
}
}</SCRIPT>
//-->