Advertisement
Guest User

Untitled

a guest
May 27th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public static attribute PathAttribute
  2. {
  3. public string Path {get;set;}
  4. }
  5.  
  6. [Path("/blah/blah/blah")]
  7. public class MyControl : UserControl {}
  8.  
  9. public abstract class EasyUserControl<T> : UserControl
  10. {
  11. public static T Create()
  12. {
  13. var UCPath = typeof(T).GetCustomAttributes(typeof(PathAttribute, false))[0].Path;
  14. return (T)(object)((Page)HttpContext.Current.Handler).LoadControl(UCPath);
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement