Close the SharePoint 2010 Modal Dialog from the code-behind

SharePoint 2010 introduces the new Modal dialog framework, which opens up a light-box type pop-up in the page. Chakradeep Chandran (an former sharepoint server MVP) wrote an excellent article/tutorial explaining how to use the sharepoint modal Dialog framework.

http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx

In addition to the Chak’s article, If you are trying to close the SharePoint Modal Dialog from the code-behind, the below code would help

HttpContext context = HttpContext.Current;
if (HttpContext.Current.Request.QueryString["IsDlg"] != null)
{
context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup()</script>");
context.Response.Flush();
context.Response.End();
}
Advertisements
Posted in Sharepoint 2010

Testing Post by Email WordPress

Here a bing background I like..

Works.. cool

Posted in Blogging
%d bloggers like this: