SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on creating event reciever for a custom list in sharepoint 2010 using visual can this event reciever be targeted to a specific custom list my case its customEmpList?

share|improve this question
up vote 8 down vote accepted

If you want to declaratively attach the event receiver, you may specify ListUrl in the Receivers Element.

  ListTemplateId = "Text"
  ListTemplateOwner = "Text"
  ListUrl = string
  RootWebOnly = TRUE | FALSE
  Scope = Site | Web>

How to: Create an Event Receiver for a Specific List Instance

share|improve this answer

Create a feature that upon activation have the proper code to attach to a specific list for e.g. :

public override void FeatureActivated(SPFeatureReceiverProperties properties)   
       SPWeb site = null;   
              //Adds the overridden ItemUpdated Event Receiver to a list   
               site = (SPWeb)properties.Feature.Parent;   
               SPList lst = site.Lists["customEmpList"];   
               string asmName = "AssemblyNameOfYourEventHandler, Version=, Culture=neutral,  PublicKeyToken=EnterThePublicKeyTokenHere";   
               string itemReceiverName = "Namespace.ClassOfEventHandler";   
               lst.EventReceivers.Add(SPEventReceiverType.ItemUpdated, asmName, itemReceiverName);   
     catch (Exception ex)






The following link contains other possible ways of attaching event handlers :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.