/// <Summary> /// IFRAME, pop up the information and jump to /// </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
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! ");}}