1. Default. aspx page
Copy codeThe Code is as follows: <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 width = "240px" cellpadding = "0" cellspacing = "0">
<Tr>
<Td style = "width: 80px">
<Asp: label ID = "Label1" runat = "server" Text = "" Width = "80px" class = "font-w"> </asp: label> </td>
<Td style = "width: 80px">
<Asp: TextBox ID = "TextBox1" runat = "server" ReadOnly = "false" Width = "80px" onfocus = "this. blur ()"> </asp: TextBox>
</Td>
<Td style = "width: 80px">
<Asp: TextBox ID = "TextBox2" runat = "server" ReadOnly = "false" Width = "80px"> </asp: TextBox>
</Td>
<Td style = "width: 80px">
<Asp: Button ID = "Button1" runat = "server" Text = "Confirm" OnClick = "button#click" CssClass = "ButtonCss"/>
</Td>
<Td>
<Asp: Label ID = "Label3" runat = "server" Text = ""> </asp: Label> </td>
<Td> <asp: Label ID = "Label4" runat = "server" Text = ""> </asp: Label> </td>
</Tr>
</Table>
2. Default. aspx. csCopy codeThe Code is as follows: protected void Page_Load (object sender, EventArgs e)
{
TextBox1.Attributes. Add ("onclick", "GetUser ('" + this. TextBox1.ClientID + "', '" + this. TextBox2.ClientID + "', 'webdialog. aspx )");
}
3. WebDialog. aspxCopy codeThe Code is as follows: <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 ID = "TxtEmpID" runat = "server" Width = "50px" ReadOnly = "true" CssClass = "InputCss"> </asp: TextBox>
<Asp: TextBox ID = "TxtEmpCName" runat = "server" Width = "60px" ReadOnly = "true" CssClass = "InputCss"> </asp: TextBox>
<Asp: TextBox ID = "TxtTitleID" runat = "server" Width = "40px" ReadOnly = "true" CssClass = "InputCss"> </asp: TextBox>
</Tr> </td>
<Tr> <td>
<Input id = "Button1" type = "button" value = "Confirm" onclick = "Submit ()"/>
</Tr> </td>
</Table>