Subpage C # background code:
Copy codeThe Code is as follows:
/// <Summary>
/// Assign the set value to the parent page
/// </Summary>
/// <Param name = "count"> value to be passed </param>
Void SetValueToParentPage (int count, string strPersons)
{
StringBuilder jsStr = new StringBuilder ();
JsStr. Append ("var retValue = new Object ();");
If (count = 0)
{
JsStr. AppendFormat ("retValue = null ;");
}
Else
{
JsStr. AppendFormat ("retValue. Nums = '{0}';", count );
JsStr. AppendFormat ("retValue. Names = '{0}';", strPersons );
}
JsStr. Append ("window. returnValue = retValue; window. close ();");
ClientScript. RegisterStartupScript (GetType (), "close", jsStr. ToString (), true );
}
Parent page front-end js:
Copy codeThe Code is as follows:
Function OpenPerChoose (url ){
Var openobj = window;
If (typeof (window. dialogArguments) = "object "){
Openobj = window. dialogArguments;
}
Var returnValue = showPopWin (url, 800,600, openobj );
If (returnValue! = Null ){
Document. getElementById ("<% = txtQualifiedNums. ClientID %>"). value = returnValue. Nums;
}
}
Copy codeThe Code is as follows:
// Pop-up window
Function showPopWin (url, width, height, returnFunc ){
Width = parseInt (width) + 30;
Height = parseInt (height) + 30;
Return window. showModalDialog (url + "& Datetime =" + GetTime (), document, "dialogWidth:" + width + "px; dialogHeight:" + height + "px; help: 0; status: 0; scroll: auto; center: 1; resizable: 1 ;");
}
<Th style = "width: 100px;">
Number of trainees:
</Th>
<Td style = "width: 50px;">
<Asp: TextBox ID = "txtQualifiedNums" runat = "server" Width = "50px" ReadOnly = "true"> </asp: TextBox>
</Td>