Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using SPSecurityTrimmedControl to view version history of list for users who have more than read permissions like this

<.SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" PermissionsString= "EditListItems" runat= "server">

<.a href="??">version history //line 3

<./SharePoint:SPSecurityTrimmedControl>

At line 3, in href, what should i put here (??), When i click on version history, I want to open small window showing Version History here. How i do this??

share|improve this question

2 Answers 2

Paste into the following code your list id and item id:

<a href="#" onclick="SP.UI.ModalDialog.showModalDialog( {url: '/_layouts/Versions.aspx?list={list guid}&ID={item id}&IsDlg=1'} ); return false;">version history</a>
share|improve this answer
    
Thanks.. I am pretty new to SharePoint. i want to display version history dialog for the current item from my web page. I could not put static item Id here in the above link. I want some piece of code where i can put dynamic item Id. (The current item id which user has selected.). I guess i need to write some code using server side api for this. Can you please help me by sending that piece of code or any useful link. Thanks.. –  SPBeginer Nov 14 '12 at 14:27
    
Correct code to get selected list item is below –  Dmitry Kozlov Nov 14 '12 at 18:17

You can use get the current selected item in the LVWP by using Client side object model code. An example would be like this:

    var context = SP.ClientContext.get_current();
    var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);
    var listId = SP.ListOperation.Selection.getSelectedList();
    var itemIds = "";
    for (var i = 0; i < selectedItems.length; i++) {
    itemIds += selectedItems[i].id + ",";
    }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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