I have an event receiver, which fires when item is being deleted ( ItemDeleting event ). I have some logic that checks whether item can be deleted or not, and if it can't, I need to show notification message - reason why item can't be deleted.

Now I would like to use SharePoint notifications, to have notification appear on the upper right corner, under the ribbons panel.

2 Answers
2

The only way you can get the call of the Javascript from the EventReceiver to the browser is through the SPEventPropertiesBase.RedirectUrl, but unfortunately you can't just specify javascript:... so you may have to:

Add something to your master page looking for a query parameter and showing the notification if that query parameter is present

In the EventReceiver set RedirectUrl to the original Url + the special query parameter

You should check it this code works as you want in all scenarios like when the users open an item in a dialog box (view/edit) and clicks delete, ...

Thanks for links, I don't think alerts would work for me, what I intended to use is notifications, and second link you've provided is all about it, thou I'm looking for a way to use it from Event Receiver.
–
MichaelSep 2 '12 at 15:02