
<%@ Register TagPrefix="WebControl" Assembly="XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c2b3ca69d93d7c67" namespace="XXXXXX"%>
In the custom list form
<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator=" " runat="server">
<Template_RightButtons>
<WebControl:SubmitButton ID="SubmitButton1" Text="Submit" WorkflowKey="Server Request" runat="server" />
<WebControl:SaveDraftButton ID="SaveDraftButton1" text="Save Draft" runat="server"/>
<SharePoint:GoBackButton runat="server"/>
</Template_RightButtons>
</wssuc:ToolBar>
Code for Save as Draft button:
namespace XXXXXXX
{
[SharePointPermission(SecurityAction.InheritanceDemand, ObjectModel = true), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class SaveDraftButton : SaveButton
{
protected override bool SaveItem()
{
bool setPermissions = ListItem.Name == null;
bool success = base.SaveItem();
if (setPermissions)
{
EventMethods.SetItemInitialPermissions(ListItem);
}
return success;
}
[SharePointPermission(SecurityAction.Demand, ObjectModel = true)]
protected override bool OnBubbleEvent(object source, EventArgs e)
{
bool flag;
string redirectUrl;
base.OnBubbleEvent(source, e);
flag = this.SaveItem();
redirectUrl = base.RedirectUrl;
SPUtility.Redirect(redirectUrl, SPRedirectFlags.UseSource, this.Context);
return flag;
}
}
}
Hi Bharat,
ReplyDeleteI tried similar thing in my list form but only one button is comming.I am trying to add button in the ribbon of the list form. Can you please tell me how did you manage to get two buttons.