The Scenario
When using Sharepoint 2010, I am able to select an item from a list:
This action then displays the Read/Edit view on that page:
My Objective
I have a WebPart located on a different Page where I display items from various lists, including this one. I would like to include a read or edit link for each of these items.
How can I achieve this?
I am looking for a function similar to
EditListItem('ItemId', 'ListId', ...)
which will open the edit div window.
What I Have Attempted
The anchor tag created by Sharepoint for the "Test Item" mentioned above appears as follows:
<a onfocus="OnLink(this)"
href="http://{mysharepointsite}/_layouts/listform.aspx
?PageType=4
&ListId={D0FDB54F-1DDF-4C5E-865B-ABDE55C1125}
&&ID=1
&&ContentTypeID=0x010800ED5176D13CCEFC4AA8D62A79985DE892"
onclick="EditLink2(this,49);return false;" target="_self">Test Item</a>
After investigating the Sharepoint JS files, I discovered that EditLink2
calls _EditLink2
, which in turn calls ShowPopup
with the context (in this case, '49' appears). The context number seems to be dynamic.
I attempted to manipulate the context value but due to numerous variables, I am unable to get it working consistently.