We've created a custom New Item page for our list on our site in Sharepoint 2010 with this code:
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<table id="tblForm" cellpadding="0" cellspacing="0" >
<SharePoint:ListFieldIterator ID="lfiARPieces" runat="server" ControlMode="New" />
<tr>
<td align="right">
<SharePoint:SaveButton ID="btnSave" runat="server" />
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
New ARPiece
</asp:Content>
We want to show a ribbon that is normally displayed on New Item page and access buttons, for example a Save button to bind some action to it (we actually want the default action to fire - just to save the item, but without the context the Save button will probably not know what to save). We managed to show the ribbon:
protected override void OnPreRender(EventArgs e)
{
SPRibbon current = SPRibbon.GetCurrent(this);
if (current != null)
{
//
current.Enabled = true;
current.Minimized = false;
current.CommandUIVisible = true;
current.MakeTabAvailable("Ribbon.ListForm.Edit");
current.InitialTabId = "Ribbon.ListForm.Edit";
current.MakeContextualGroupInitiallyVisible("Ribbon.ListForm.Edit.Commit", string.Empty);
}
}
What should we do to bind the actions?