Passing parameters to the dialog sharepoint 2010 Client Object model
09/05/2010 • Admin
Category: SharePoint 2010
The most asked questions in our Forum below is about how to get the selected items from a list using and how to pass them or any other parameter as a querystring to the dialog page.
forum posts :
Get selected items in a list sharepoint 2010
sharepoint 2010 dialogue pass querystring
To answer both the questions our guest user sharepointgeek has posted a fairly simple example. The example below will get the selected items from your current list and add it to the myitems string seprated by “|”. Then we create an option variable and construct the url passing the selected items and listname as parameters.
var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var myItems = ”;
var k;
for (k in items)
{
myItems += ‘|’ + items[k].id;
}
var options = {
url: ‘/_layouts/Customdialog/mydialog.aspx?items=’ + myItems + ‘&source=’ + SP.ListOperation.Selection.getSelectedList(),
tite: ‘Move Documents’,
allowMaximize: false,
showClose: false,
width: 800,
height: 600,
dialogReturnValueCallback: demoCallback };
SP.UI.ModalDialog.showModalDialog(options);”



Recent Forum Posts
Linq to Sharepointby RS on May 18, 2012
comments on the codeby spbsmile on May 18, 2012
connection(add) EditControlBlock and my programby spbsmile on May 18, 2012
Custom master pages used in multiple SharePoint 2010 sitesby ubersteve on May 18, 2012
upload file and click on button but cant upload file into list by using below codeby santhoshreddy on May 18, 2012