Saturday, March 6, 2010

Custom Dialog in Sharepoint 2010

Custom Dialog in Sharepoint 2010


The easiest way to show this is with an application page:

<asp:Content ID=”Main” ContentPlaceHolderID =”PlaceHolderMain” runat=”server”>
<script type=”text/javascript”>
function ShowDialog()
{
var DialogOptions =SP.UI.$create_DialogOptions();
DialogOptions.url=”http://www.google.com”;
DialogOptions.width=500;
DialogOptions.height=400;
DialogOptions.dialogReturnValueCallback=Function.CreateDelegate(null,CloseFunction);
}


function CloseFunction(results,target)
{
if (results == SP.UI.DialogResult.OK)
{
alert(“You have clicked OK button”);
}
}
 </script>
<input type=”button” value=”Show Google” onClick=”ShowDialog()” />
</asp:Content>