Blog Categories

Subscribe to RSS feed


Buttons in the SharePoint Form

I was recently having an IM discussion with a colleague that reminded me of something I discovered a while back. It’s pretty simple, but I thought I’d post it here in case it helps anyone.
In a custom ASPX page in SharePoint, you can get the nifty Cancel button to show up (and actually be functional!) without writing any code.
Assuming you have a Save button that executes custom code, in your ASPX file:
<wssuc:ButtonSection runat="server">
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<asp:Button runat="server" class="ms-ButtonHeightWidth2" OnClick="BtnSave_Click" Text="Save" id="btnSave" />
This will automatically include a Cancel button whose behavior is to redirect to the URL defined in the "Source" QueryString parameter.

Leave a Reply