How to set an error message from EditorPart when ApplyChanges returns false?

Posted by jmservera on Stack Overflow See other posts from Stack Overflow or by jmservera
Published on 2010-05-27T13:26:22Z Indexed on 2010/05/28 7:31 UTC
Read the original article Hit count: 152

Filed under:

I'm developing a custom ASP.Net WebPart using the WebPartManager and I'm creating a custom EditorPart too. For its EditorPart.ApplyChanges method I set the return value to false whenever there is an error.

In the EditorZone I get a standard error message indicating that some error happened to the editor, but I want to change that message. Is that possible? Something like...

 public override bool ApplyChanges()
 {
  try
  {
     // save properties
     return true;
  }
  catch(Exception ex)
  {
     ErrorMessage = ex.Message; // is there any similar property I can fill?
     return false;
  }
 }

© Stack Overflow or respective owner

Related posts about webparts