TemplateControlParser.cs 952 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. namespace System.Web.UI
  14. {
  15. public abstract class TemplateControlParser : TemplateParser
  16. {
  17. internal object GetCompiledInstance (string virtualPath, string inputFile, HttpContext context)
  18. {
  19. InputFile = inputFile;
  20. Type type = CompileIntoType ();
  21. if (type == null)
  22. return null;
  23. object ctrl = Activator.CreateInstance (type);
  24. if (ctrl == null)
  25. return null;
  26. HandleOptions (ctrl);
  27. return ctrl;
  28. }
  29. protected override void HandleOptions (object obj)
  30. {
  31. Control ctrl = obj as Control;
  32. Hashtable options = Options;
  33. if (options == null)
  34. return;
  35. if (options ["AutoEventWireup"] != null)
  36. ctrl.AutoEventWireup = (bool) options ["AutoEventWireup"];
  37. }
  38. }
  39. }