Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

ItemUpdating event error message

  Asked By: Mercedes    Date: Jan 18    Category: Sharepoint    Views: 1805

I'm trying to display a custom error message for the ItemUpdating
event on a list item. My code looks something like this:

public override void ItemUpdating(SPItemEventProperties properties) {
properties.Cancel = true;
properties.ErrorMessage = "Error Message";

It works fine by cancelling the request, but all I get is the default
asp error page with my error message on top and then the stack trace.



2 Answers Found

Answer #1    Answered By: Michelle White     Answered On: Jan 18

You should get the error  page with your error message. You should not
get a stack trace  because the cancel  doesn't throw an exception.
Something else must be wrong with the code.

Answer #2    Answered By: Sheena Ray     Answered On: Jan 18

You only get the stack trace  if the web.config file is configured to
provide that detail but otherwise this is the expected behavior. Try
setting StackTrace="False" and CustomErrors="On".

Didn't find what you were looking for? Find more on ItemUpdating event error message Or get search suggestion and latest updates.