Sunday, June 2, 2013

SharePoint 2010 Close Module Dialog through code







Close Module Dialog SharePoint from server side Code and javascript

Javascript



C#


//current Context
HttpContext Currentcontext = HttpContext.Current;
//Checking  dialog is  open on this page or not
if (HttpContext.Current.Request.QueryString["IsDlg"] != null)
{
//executing javascript for closing pop on runtime;
Currentcontext.Response.Write("");
Currentcontext.Response.Flush();
Currentcontext.Response.End();

}


from update panel

///

/// Call Runtime Javascript Functions
///
/// type Complete Function and js Code
private void CallJavaScriptMethods(string Script)
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), Guid.NewGuid().ToString(), Script, true);
}


ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), Guid.NewGuid().ToString(), "window.frameElement.commitPopup();", true);

No comments:

Post a Comment