dinsdag 21 februari 2012

Give Custom Save button with Sharepoint Layout and Redirection

People are adding custom controls to there sharepoint pages, but the buttons doesn't have 
the same look and feel as the one Sharepoints generates itselfs. 
But I wouldn't be a developer to give you a solution with gives you your buttons the same
look and feel as the Sharepoint buttons. 

To get this, you must not add a HTML Button element, but a Input element of the type button.
For giving it the same look and feel of Sharepoint Buttons you have to 
add a Sharepoint CSS class named "ms-ButtonHeightWidth"

In the example below you have a Button that you can use instead of the generated Save button 
and that redirects your page after saving your content to an other location 
than the standard view of your list in Sharepoint.
For the redirection you have to add some code that generates an event after a succesfull SaveAction.

<input type="button" value="Save" name="SaveButton" class="ms-ButtonHeightWidth" onclick="if (!PreSaveAction()) return false;{ddwrt:GenFireServerEvent('__commit;__redirect={<<SITE URL TO REDIRECT>>};')}" />

Geen opmerkingen:

Een reactie posten