I was recently tasked with creating a Edit List Item Link button in a WebPart for a SharePoint List. The button will act identical to the Edit Item button on the UIRibbon, but needs placed above the list in a webpart. FYI the client is aware of the "Edit Item" button on the Ribbon, but would like another button above the list".

Can anyone assist me in the correct javacript code that will get the selected list item ID and then open the edit form in a dialog page with the selected item metadata?

2 Answers 2


This should get you started as far as getting selected items: https://stackoverflow.com/questions/12632861/how-to-get-the-selected-item-in-a-connected-listviewer-web-part-using-javascript

And for showing a dialog: http://msdn.microsoft.com/en-us/library/ff410058%28v=office.14%29.aspx


Here is another option that doesn't require any added code. If the Edit List Item Link button doesn't have to be above the list in a webpart, you could opt to add an Edit Item icon to a list view itself, and it will be inline on the row with the item.
Edit item icon in list view

Modify the List View (or the if a webpart on a page, go to > Edit Web Part > Edit current view)
In the list of columns, select:
enter image description here

Set it as the first column to make it easy to find. This makes it very apparent to the end user who is not familiar with the quirks of SharePoint how to edit that item, rather than having to select the item and to go to Edit on the ribbon, or trying to figure out that the "..." opens the item menu to get to the Edit Item link.

You get a cleaner list view (remove the ellipsis and tabular view elements), a cleaner page (no script editor web part needed), as well as something that can be easily added onto other lists/views without getting a dev involved.

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.