Copy Code code as follows:
<summary>
IFRAME, pop-up message 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);
}
Page Invoke CS file
Copy Code code 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, "Save failed!") ");
}
}