Search code examples
c#javascriptjquerysharepoint-2007messagebox

Confirmation Box in SPItemEventReceiver class


I want to display a confirmation box in SpItemEventReceiver class using just C# or any script or plugin (e.g. jQuery) with it.

I have researched the problem and I believe that I can do something like build a string and display it on this item adding form but I read it in this SharePoint King blog post (I am NOT advertising them) that it's not possible if you search for the text. Here's an excerpt:

Is there any way we can show a custom message box when an event is fired and continue with the event?
No, that is not possible from the method described here. You can put alert on button click of the form by the javascript but can not be done by an event handler.

I wonder if someone can confirm whether can or we can't do it, as I think we can but don't know how. Here's a piece of code I'm trying:

class className: SPItemEventReceiver
{
    public override void ItemAdding(SPItemEventProperties properties)
    {
        try
        {
            this.DisableEventFiring();
            //Display a Message box here

[Edit:] Will the HttpContext.Response property work in this context?


Solution

  • Showing a message box won't work here; if it worked the message box would be shown on the server because that's where this code runs. What you could use server-side is the SharePoint

    Page Status MSDN