Monday, 22 September 2014

Generating popup window using java script in sharepoint by click on the Button

function popupWindow()
{
var options = SP.UI.$create_DialogOptions();
options.width = 700;
options.height = 300;
options.url = "http://servername:Portnumber/sitename/Lists/ListName/CustomNew.aspx";
options.dialogReturnValueCallback = Function.createDelegate(
null, participant_DialogCallback);
SP.UI.ModalDialog.showModalDialog(options);
}

Here CustomNew is a aspx page created via Sharepoint Designer.


function participant_DialogCallback(result,value)
{
window.location.href = "http://servername:Portnumber/sitename/SitePages/HomePage.aspx";


}

<button type="button" id="btnAssign" onclick="javascript:popupWindow();"> Assign</button>

Here we are going to created button called as Assign, whenever user clicks on the button, popupWindow was going to fire. The above line of code we can place in  inline.

No comments:

Post a Comment