2
0

TemplateControlParser.cs 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // System.Web.UI.TemplateControlParser
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc (http://www.ximian.com)
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.IO;
  12. using System.Web.Compilation;
  13. using System.Web.Util;
  14. namespace System.Web.UI
  15. {
  16. public abstract class TemplateControlParser : TemplateParser
  17. {
  18. internal object GetCompiledInstance (string virtualPath, string inputFile, HttpContext context)
  19. {
  20. Context = context;
  21. InputFile = MapPath (virtualPath);
  22. Type type = CompileIntoType ();
  23. if (type == null)
  24. return null;
  25. object ctrl = Activator.CreateInstance (type);
  26. if (ctrl == null)
  27. return null;
  28. HandleOptions (ctrl);
  29. return ctrl;
  30. }
  31. protected override void HandleOptions (object obj)
  32. {
  33. Control ctrl = obj as Control;
  34. Hashtable options = Options;
  35. if (options == null)
  36. return;
  37. if (options ["AutoEventWireup"] != null)
  38. ctrl.AutoEventWireup = (bool) options ["AutoEventWireup"];
  39. }
  40. }
  41. }