Custom error message i edit mode?

Vote:
 
Hi! In edit mode i sometimes get the standard yellow box with an error message if i do something wrong. I'd like to generate this yellow box with an custom error message. Is it possible? My problem is that my page requiers one or more categories to be checked. When page is saved in editmode i can catch the event and check if categories == 0 (no problem), but i dont know how to handle the error if no categories are checked. Hence the custom error message... Help appreciated! /Kimmo
#13371
Mar 25, 2008 18:36
Vote:
 
Nevermind, i solved it... in global.asax: protected void Instance_SavingPage(object sender, EPiServer.PageEventArgs e) { MyClass.MyFunction(e); } In MyFunction: public static void MyFunction(EPiServer.PageEventArgs e) { try { if (something) { throw new Exception("message"); } } catch (Exception ex) { e.CancelAction = true; e.CancelReason = ex.Message.ToString(); } }
#19085
Mar 26, 2008 10:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.