title: Access parent class from custom attribute
body: <p>Is it possible to access a parent class from within an attribute.</p>
  
  <p>For example I would like to create a DropDownListAttribute which can be applied to a property of a viewmodel class in MVC and then create a drop down list from an editor template. I am following a similar line as Kazi Manzur Rashid <a href="http://weblogs.asp.net/rashid/archive/2009/11/27/extending-asp-net-mvc-2-templates.aspx" rel="nofollow noreferrer">here</a>.</p>
  
  <p>He adds the collection of categories into viewdata and retrieves them using the key supplied to the attribute.</p>
  
  <p>I would like to do something like the below,</p>
  
  <pre><code>public ExampleDropDownViewModel {
  
     public IEnumerable&lt;SelectListItem&gt; Categories {get;set;}
  
     [DropDownList("Categories")]
     public int CategoryID { get;set; }
  }
  </code></pre>
  
  <p>The attribute takes the name of the property containing the collection to bind to. I can't figure out how to access a property on the parent class of the attribute. Does anyone know how to do this?</p>
  
  <p>Thanks</p>