Copy codeThe Code is as follows:
/// <Summary>
/// In iframe, pop up the information and jump
/// </Summary>
/// <Param name = "msg"> </param>
/// <Param name = "targetPageName"> </param>
Public static void ResponseShowMsg (string msg, string targetPageName)
{
String str = "<script> alert ('{0}'); window. parent. frames [\ "sysMain \"]. location. href = '{1}'; </script> ";
String Urls = HttpContext. Current. Request. Url. OriginalString;
If (Urls. LastIndexOf ('? ')> 0)
{
Urls = Urls. Substring (0, Urls. LastIndexOf ('? '). Replace (HttpContext. Current. Request. Url. Segments [HttpContext. Current. Request. Url. Segments. Length-1], targetPageName );
}
Else
{
Urls = Urls. Replace (HttpContext. Current. Request. Url. Segments [HttpContext. Current. Request. Url. Segments. Length-1], targetPageName );
}
Str = string. Format (str, msg, Urls );
HttpContext. Current. Response. Write (str );
}
Call the cs file on the page
Copy codeThe Code is as follows:
Protected void btnSave_Click (object sender, EventArgs e)
{
If (bll. RoleAdd (model, tempMs ))
{
CmvspCommon. MessageBox. ResponseShowMsg ("saved successfully! "," Add. aspx ");
}
Else {
CmvspCommon. MessageBox. Show (this, "failed to save! ");
}
}