I have a problem with displaying error messages inline, but sharepoint displays that ugly yellow page. Yes the error message is correct, it's the one I defined but I need to display errors like the picture below, inline.
Now I got error like this.
and I want to display it right here. I know it's possible but couldn't figure it out.
and here is my code
public override void ItemAdding(SPItemEventProperties properties)
{
base.ItemAdding(properties);
...
...
if (mycondition)
{
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "Staff not found, check staff number and try again.";
}
}
I'm pretty sure this code was working before but now displays that ugly page. What should I do to fix it?
EDIT 1 There are some other lists that event receivers work as expected and error is displayed in the form page. This particular list that I'm having trouble was deleted and imported from a file exported from another sharepoint machine. I believe after import this problem occurred.
EDIT 2 Ok here it is. This is a subsite and a dummy custom list usin existing event receiver. This event receiver runs on every custom list named Staff on any site. Here it displays the error message on the form page which is what I want. I can't delete my actual custom list that is having problem because in the future I'll use import functionality to import list and need to fix it without deleting/recreating it.
EDIT 3 Ok found the problem, if I add an existing column "Rollup Image" on submit page starts to give that ugly .net error page. Now we know what's causing trouble, how can I fix that?