I have the following javascript:


And I'm wondering if there is a Server Side Object Model equivalent to this that I could use in Page Load?

The javascript is on an ascx that is being displayed when users click on an custom button that has been added to the ribbon.

1 Answer 1


Umm, they are only selecting things on the client side so no, there isn't anything on the server side.

They way i've handled what I think you are trying to accomplish is to pass the values through a querystring. See code below:

function myAction(){
    var items = SP.ListOperation.Selection.getSelectedItems();
    var listId = SP.ListOperation.Selection.getSelectedList();
    var itemCount = CountDictionary(items);

    if (itemCount == 0)

    var ids = "";
    for (var i = 0; i < itemCount; i++) {
        ids += items[i].id + ";";

    var uri = "_layouts/CustomApp.aspx";
    var queryParams = "?listId=" + listId + "&itemIds=" + ids;
    var relativeUrl = L_Menu_BaseUrl;

    var options = {};
    options.url = appendTrailingSlash(relativeUrl) + uri + queryParams;
    options.title = 'Custom App';
    options.autoSize = true;
    options.showClose = true;
    options.allowMaximize = true;
    options.dialogReturnValueCallback = onFinish;


function appendTrailingSlash(url) {
    if (url.length > 0 && url.charAt(url.length - 1) == '/')
        return url;
        return url + '/';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.