1.Default.aspx页面
复制代码 代码如下:
<script type="text/javascript">
function GetUser(TxtEmpID,TxtEmpName,url)
{
var properties = 'status:no;resizable:no;toolbar=no;menubar=no;location=no;scroll:no;dialogWidth:540px;dialogHeight:450px;'
var arg=window.showModalDialog(url,"",properties);
if(arg!=null)
{
document.getElementById(TxtEmpID).value=arg[0];
document.getElementById(TxtEmpName).value=arg[1];
}
}
</script>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Label runat="server" Text="選擇課級別一"></asp:Label></td>
<td>
<asp:TextBox runat="server" ReadOnly="false" onfocus="this.blur()"></asp:TextBox>
</td>
<td>
<asp:TextBox runat="server" ReadOnly="false" ></asp:TextBox>
</td>
<td>
<asp:Button runat="server" Text="確定" CssClass="ButtonCss"/>
</td>
<td>
<asp:Label runat="server" Text=""></asp:Label></td>
<td> <asp:Label runat="server" Text=""></asp:Label></td>
</tr>
</table>
2.Default.aspx.cs
复制代码 代码如下:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onclick", "GetUser('" + this.TextBox1.ClientID + "','" + this.TextBox2.ClientID + "','WebDialog.aspx)");
}
3.WebDialog.aspx
复制代码 代码如下:
<script language="javascript" type="text/javascript">
function Submit()
{
var arr=new Array();
arr[0]= document.getElementById('TxtEmpID').value
arr[1]= document.getElementById('TxtEmpCName').value
arr[2]= document.getElementById('TxtTitleID').value
window.returnValue=arr;
window.close();
}
</script>
<table>
<tr><td>
<asp:TextBox runat="server" ReadOnly="true" CssClass="InputCss"></asp:TextBox>
<asp:TextBox runat="server" ReadOnly="true" CssClass="InputCss"></asp:TextBox>
<asp:TextBox runat="server" ReadOnly="true" CssClass="InputCss"></asp:TextBox>
</tr></td>
<tr><td>
<input type="button" value="確 定"/>
</tr></td>
</table>
您可能感兴趣的文章: