I have a user control in the code behind and I get SPListItem (which is a specific item from one SharePoint list). And I need place on my user control buttons to manage this item (edit and delete). Can I use any patterns, which repeat behaviour of standard SharePoint list command (edit in modal dialog, delete with prompt?)
By example, I can add in ascx file html code:
<img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-128px !important;position:absolute;" /></span>
<a class="ms-addnew" id="idHomePageNewItem" href=".../_layouts/listform.aspx?PageType=8&ListId={03C30976-7C6C-4815-8EB2-2793A97D2EC}&RootFolder="
onclick="javascript:NewItem2(event, ".../_layouts/listform.aspx?PageType=8&ListId={03C30976-7C6C-4815-8EB2-72793A97D2EC}&RootFolder=");javascript:return false;"
target="_self">Add Item</a>
And this link work same as link button in standart sharepoint list view.
And I need add also “Delete Item” link and “Edit Item” link. (I know ItemID, list GUID and etc).
You can add the “delete” functionality by just adding the code for deletion in the code behind of the control, so this shouldn’t be an issue.
To retrieve the url for the edit form you can use following code:
This allows you to navigate to the edit form. If you want it to display in a popup you can use the “SP.UI.ModalDialog.showModalDialog” functionality.