.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Interview Question >> SharePoint >> Post New Question Subscribe to Interview Questions

How many event handlers in sharepoint?

Posted By :Sagar Pardeshi     Posted Date :February 10, 2011    Points :15   Category :SharePoint 

You can also find related Interview Question to How many event handlers in sharepoint?  below: 

List the event handlers that can be included in Global.asax?

o Application start and end event handlers
o Session start and end event handlers
o Per-request event handlers
o Non-deterministic event handlers (More...)

What event handlers can I include in Global.asax?

Application_Start,Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache, Session_Start,Session_End
You can optionally include "On" in any of method names. For example, you can name a BeginRequest event handler.Application_BeginRequest or Application_OnBeginRequest.You can also include event handlers in Global.asax for events fired by custom HTTP modules.Note that not all of the event handlers make sense for Web Services (they're designed for ASP.NET applications in general, whereas .NET XML Web Services are specialized instances of an ASP.NET app). For example, the Application_AuthenticateRequest and Application_AuthorizeRequest events are designed to be used with ASP.NET Forms authentication.

Which are main event classes of sharepoint Eventreceiver?

There are three main event classes:

SPWebEventReceiver (More...)

What is WebAdding Event in SharePoint

WebAdding event in SharePoint is a synchronous event which raised before a new Web site is created. This event gives us options to even cancel the site creation. This event can be used to perform conditional validations and the user who is creating a site has appropriate credentials. (More...)

What is WebProvisioned event in SharePoint.

WebProvisioned event in SharePoint occurs after the Web is fully provisioned and the provisioning process has completed. This event can be configured to operate in either synchronous or asynchronous modes. This event is used for post deployment operations. (More...)

Explain Event Listener in SharePoint 2013.

The event listener in SharePoint 2013 includes an event subscriber. The subscriber receives notifications from the event publisher (on the external system side) on changes to the data and then initiates predefined actions when changes occur. (More...)

What is Event receiver in SharePoint?

Event receivers can be applied to List,Document Libraries and Content Types inside a Sharepoint Site.Event receivers can be applied for different operations on a list item such as adding,updating and deleting the list item.

What are the base classes, event handlers can inherit.

While developing event handlers there are several base classes from which you can inherit.

SPItemEventReciever: One must inherit from this base class if you want the event handler to be executed when the item is added,updated and deleted.

SPListEventReciever: One must inherit from this base class when you want the event handler to execute when the structure of the list is modifed or the content type added or removed from the list.

SPFeatureEventReciever: Inherit this base class if you want your event handler to execute when the feature events such as installation,unstallation,activation and deactivation are executed.

SPWebEventReciever: You can Inherit this base class if you want your event handlers to execute when site is added or removed from the site collection.

SPEmailEventReciever:Inherit this base class for creating a event handler for emails that are send to a Sharepoint list.

Remote event receivers in SharePoint 2013?

: Remote Event Receiver is used to handle such events when app for SharePoint running on other system from the host web. Remote Event Receiver uses web service to call code when any event is triggered.
You can use Visual Studio templates to add Remote Event Receiver as we did for event receiver in earlier version. Once remote event receiver is added, it will create new WCF service in app's remote web site that implements IRemoteEventService interface where in traditional event receiver uses SPItemEventReceiver interface.
RemoteEventService interface define methods that can be called when any event occurs by SharePoint objects.
Following methods used by Remote event receiver:
. ProcessEvent - Used to process two way events before an action occur which has SPRemoteEventResult type of output. This is Synchronous event that can handle -ing events.
. ProcessOneWayEvent - Used to process one way events after an action occurs which none has output. This is Asynchronous event that can handle -ed events.
Remote Event Receiver can only work with Auto Hosted and Provider Hosted apps not for SharePoint Hosted app.
Remoter Event Receiver is supported only at List and List Item level.
Remote Event Receiver cannot run client side JavaScript code as its uses WCF Service to callback when remote event occurs. And it requires server side code.

the difference between a delegate and an event

the difference between a delegate and an event


Here is the difference between a delegate and an event.


public class VikramDel


public delegate void VikramExampleDelegate(int num1,string str1);

public VikramExampleDelegate VikramDeleageteCallback;



public class VikramEvent


public delegate void VikramExampleEvent(int num1,string str2);

public event VikramExampleEvent VikramEventCallback;


So syntax wise there is only one difference that we have to use the event keyword with the event.

So the question comes why do we have a keyword when the same work can be done without using it. But there is a reason for the existence of the keyword event. Lets take an example how would a client work with this class

VikramDel V = new VikramDel();

V.VikramDeleageteCallback +=new

VikramDel.VikramExampleDelegate (this.VikDelegate);

Here we are adding a new target to the invocation list of the delegate. The same code will work with the other class also without any problem

VikramEvent V = new VikramEvent();

V.VikramEventCallback + =new


But consider a case where by instead of adding a new target to the invocation list of the delegate if I simply set a delegate to a new delegate (The difference is with the + sign being not there).

VikramDel V = new VikramDel();

V.VikramDeleageteCallback =new

VikramDel.VikramExampleDelegate (this.VikDelegate);

This code will work fine here but the same will not work with an event.

So what it means is that if we use the event keyword no client class can set it to null. This is very important. Multiple clients can use the same delegate. After multiple client have added a function to listen to the callback of the delegate. But now one of the client sets the delegate to null or uses the = sign to add a new call back. This means that the previous invocation list will not be used any more. Hence all the previous client will not get any of the callback even if they have registered for the call back.

Hence we can say that the even keyword adds a layer of protection on the instance of the delegate. The protection prevents any client to reset the delegate invocation list. They can only add or remove the target from the invocation list. (More...)

What's a Bubbled Event ?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents (More...)

How do I detach an event handler?

In the same way you attach an event handler, except using the -= operator.
For example:

button1.Click -= new EventHandler (button1_Click); (More...)

What is Sharepoint?

Sharepoint is a Portal Collaboration Software provided by Microsoft , That can be configured to run Intranet, Extranet and Internet sites (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend