2

I have created a sharepoint item updating event receiver for a custom list. The event receiver checks certain condition and block the user from saving the item if the condition fails. TO display the warning, i have used

 properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.errormessage= "error"; 

Now it shows error message below the form in red font. I want to change the formatting of the text, and want to show the error message in bold characters. How can this be achieved, any help on this will be appreciated.

Thanks

1

if you inspect the html, you will find something that might help

span[role="alert"]
{
     font-weight:bold;
}

you can apply this css locally (CEWP) or globally (master page/alternatecssurl reference)

0

Use this one instead

properties.ErrorMessage = "Error";
properties.Cancel = true;
properties.Status = SPEventReceiverStatus.CanceWithRedirectUrl;
properties.RedirectUrl = "your custom error page"

You can find more information here

  • I do not want to redirect on to the different page, instead I want to show on the same edit form – Muskan Oct 25 '17 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.