Show Application Page in SharePoint 2010 Modal PopUp
Recently i was creating SharePoint webpart here we need to show application page in popup. After a lot of time to searching finally we found SharePoint Popup model as solution. here we give the brief explanation of using SharePoint model popup.
call the JavaScript method in your code
and pass URL as parameter as shown in below code.
<a
href="javascript:OpenDialog(_layouts/xxxxxx/xxxxx.aspx');">MyPopUp</a>
implement JavaScript method, in that calling
sharepoint inbuilt method show model dialog as shown in below code.
<script
type="text/javascript">
function
OpenDialog(URL)
{
var
NewPopUp = SP.UI.$create_DialogOptions();
NewPopUp.url = URL;
NewPopUp.width = 400;
NewPopUp.height = 250;
SP.UI.ModalDialog.showModalDialog(NewPopUp);
}
</script>
Close the popup using HTTP context objects with window
commit popup.
public void closePopUp()
{
Context.Response.Write("<script
type='text/javascript'>window.frameElement.commitPopup();</script>");
Context.Response.Flush();
Context.Response.End();
//Response.Redirect(SPContext.Current.Site.Url);
}
Comments
Post a Comment