title: Attaching a event receiver to a content type
body: <p>I created some site columns / a content type and a list definition as part of a feature.  I want to attach an eventreceiver to the content type.  I added code to attach the event receiver to the content type. Using spmanager i can see that the event receiver is attached to the content type however when i create lists from the content type the event reciever is missing.  Any ideas.  My code is below</p>
  
  <pre><code>  public override void FeatureActivated(SPFeatureReceiverProperties properties)
              {
                  string asmName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
                  string itemReceiverName = "xxxxxx.Intranet.SP.xxxxx.PermissionsUpdaterEventReceiver";
  
                  ////surely a better way to get all lists than this
                  ////re - do
                  using (SPSite thisSite = (SPSite)properties.Feature.Parent) {
                      using (SPWeb web = thisSite.RootWeb) {
                          SPContentType RambollNewsContentType = web.ContentTypes["RambollNewsContentType"];
                          RambollNewsContentType.EventReceivers.Add(SPEventReceiverType.ItemAdded, asmName, itemReceiverName);
                          RambollNewsContentType.Update(true);
                      }
                  }    
              }
  </code></pre>