Learning SharePoint   Enhance Your SharePoint Knowledge

Subscribe to Learning SharePoint Subscribe
Twitter Learning SharePointFollow Us
in Learning SharePoint
Check Out Our New SharePoint 2013 series!

Passing parameters to the dialog sharepoint 2010 Client Object model

09/05/2010  
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);”

Subscribe to Learning SharePoint Subscribe
Twitter Learning SharePointFollow Us
in Learning SharePoint
Advertisement

Random Posts

get\set external List Throttling using powershell – SharePoint 2010
get\set external List Throttling»

The following PowerShell script demonstrates how to get and set the External List throttles: $snapin = Get-PSSnapin | where-object {»

Installing Sharepoint foundation 2010 on Windows 7 home edition
Installing Sharepoint foundation 2010»

Finally! I installed Sharepoint foundation 2010 on my Windows 7 home edition. It took me a while but i did »

User Profile Synchronization Service Hanged at “Starting” – Sharepoint 2010
User Profile Synchronization Service»

A lot of people have mentioned their user profile Synchronization service getting stuck on ‘starting’. You could try the below»

Recent Forum Posts

Linq to Sharepoint

by RS on May 18, 2012

comments on the code

by spbsmile on May 18, 2012

connection(add) EditControlBlock and my program

by spbsmile on May 18, 2012

Custom master pages used in multiple SharePoint 2010 sites

by ubersteve on May 18, 2012

upload file and click on button but cant upload file into list by using below code

by santhoshreddy on May 18, 2012