Following steps for Custom Error Page.
1. Update the Event Receiver: ItemAdding Section's Code would be:
public override void ItemAdding(SPItemEventProperties properties)
{
base.ItemAdding(properties);
if (!properties.AfterUrl.EndsWith("pdf"))
{
properties.Status=SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = "/_Layouts/ERTest/ApplicationPage1.aspx";
}
}2. Add a Application Page to the Project, optionally a Icon to represent Error.


See the Result in action: SharePoint 2010 event receiver custom error page.
No comments:
Post a Comment