test1.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Web;
  3. using System.Web.UI;
  4. using System.Web.UI.WebControls;
  5. public class CompositePoker : CompositeControl
  6. {
  7. public CompositePoker () {
  8. }
  9. protected override void CreateChildControls () {
  10. throw new Exception ("who called me?");
  11. }
  12. }
  13. public class Test {
  14. public static void Main (string[] args) {
  15. CompositePoker poker;
  16. poker = new CompositePoker ();
  17. Console.WriteLine ("DataBind");
  18. Console.WriteLine ("--------");
  19. try { poker.DataBind(); } catch (Exception e) { Console.WriteLine (e);}
  20. poker = new CompositePoker ();
  21. Console.WriteLine ("Render");
  22. Console.WriteLine ("--------");
  23. try { poker.DataBind(); } catch (Exception e) { Console.WriteLine (e);}
  24. poker = new CompositePoker ();
  25. Console.WriteLine ("Controls");
  26. Console.WriteLine ("--------");
  27. try { ControlCollection c = poker.Controls; } catch (Exception e) { Console.WriteLine (e);}
  28. poker = new CompositePoker ();
  29. ICompositeControlDesignerAccessor accessor = (ICompositeControlDesignerAccessor)poker;
  30. Console.WriteLine ("RecreateChildControls");
  31. Console.WriteLine ("--------");
  32. try { accessor.RecreateChildControls(); } catch (Exception e) { Console.WriteLine (e);}
  33. }
  34. }