MultiViewTest.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. //
  2. // Tests for System.Web.UI.WebControls.View.cs
  3. //
  4. // Author:
  5. // Yoni Klein ([email protected])
  6. //
  7. // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. //
  28. #if NET_2_0
  29. using NUnit.Framework;
  30. using System;
  31. using System.IO;
  32. using System.Globalization;
  33. using System.Web;
  34. using System.Web.UI;
  35. using System.Web.UI.WebControls;
  36. using MonoTests.SystemWeb.Framework;
  37. using MonoTests.stand_alone.WebHarness;
  38. namespace MonoTests.System.Web.UI.WebControls
  39. {
  40. class PokerMultiView : MultiView
  41. {
  42. public PokerMultiView ()
  43. {
  44. TrackViewState ();
  45. }
  46. public object SaveState ()
  47. {
  48. return SaveControlState ();
  49. }
  50. public void LoadState (object o)
  51. {
  52. LoadControlState (o);
  53. }
  54. public StateBag StateBag
  55. {
  56. get { return base.ViewState; }
  57. }
  58. public string Render ()
  59. {
  60. StringWriter sw = new StringWriter ();
  61. HtmlTextWriter tw = new HtmlTextWriter (sw);
  62. Render (tw);
  63. return sw.ToString ();
  64. }
  65. public void DoAddParsedSubObject (object e)
  66. {
  67. AddParsedSubObject (e);
  68. }
  69. public void DoOnActiveViewChanged (EventArgs e)
  70. {
  71. base.OnActiveViewChanged (e);
  72. }
  73. public void DoBubbleEvent (object source, EventArgs e)
  74. {
  75. OnBubbleEvent (source, e);
  76. }
  77. public void AddViewCtrl (View v)
  78. {
  79. this.Controls.Add (v);
  80. }
  81. }
  82. [TestFixture]
  83. public class MultiViewTest
  84. {
  85. [SetUp]
  86. public void SetUp ()
  87. {
  88. WebTest.CopyResource (GetType (), "NoEventValidation.aspx", "NoEventValidation.aspx");
  89. }
  90. [Test]
  91. public void MultiView_DefaultProperties ()
  92. {
  93. PokerMultiView pmw = new PokerMultiView ();
  94. Assert.AreEqual (0, pmw.StateBag.Count, "ViewState.Count");
  95. Assert.AreEqual (-1, pmw.ActiveViewIndex, "ActiveViewIndex");
  96. Assert.AreEqual (0, pmw.Views.Count, "DefaultZeroViews");
  97. Assert.AreEqual (PokerMultiView.NextViewCommandName, "NextView", "DefaultNextViewCommandName");
  98. Assert.AreEqual (PokerMultiView.PreviousViewCommandName, "PrevView", "DefaultPrevViewCommandName");
  99. Assert.AreEqual (PokerMultiView.SwitchViewByIDCommandName, "SwitchViewByID", "SwitchViewByIDCommandName");
  100. Assert.AreEqual (PokerMultiView.SwitchViewByIndexCommandName, "SwitchViewByIndex", "SwitchViewByIndexCommandName");
  101. }
  102. [Test]
  103. public void MultiView_NotWorkingDefaultProperties ()
  104. {
  105. PokerMultiView pmw = new PokerMultiView ();
  106. Assert.IsTrue (pmw.EnableTheming, "EnableTheming");
  107. }
  108. [Test]
  109. public void MultiView_AddViews ()
  110. {
  111. PokerMultiView pmv = new PokerMultiView ();
  112. View v1 = new View ();
  113. pmv.Controls.Add (v1);
  114. Assert.AreEqual (1, pmv.Views.Count, "ViewsCount");
  115. Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndex");
  116. }
  117. [Test]
  118. public void MultiView_ActiveIndex ()
  119. {
  120. PokerMultiView pmv = new PokerMultiView ();
  121. View myView = new View ();
  122. Assert.AreEqual (-1, pmv.ActiveViewIndex, "ActiveViewIndexDefault");
  123. pmv.ActiveViewIndex = 0;
  124. Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexChange");
  125. pmv.Controls.Remove (myView);
  126. Assert.AreEqual (0, pmv.Controls.Count, "ControlsCount");
  127. Assert.AreEqual (0, pmv.ActiveViewIndex, "ActiveViewIndexRemove");
  128. }
  129. [Test]
  130. public void MultiView_SetActiveView ()
  131. {
  132. PokerMultiView pmw = new PokerMultiView ();
  133. PokerView pv1 = new PokerView ();
  134. pmw.Controls.Add (pv1);
  135. pmw.SetActiveView (pv1);
  136. Assert.AreEqual (pv1, pmw.GetActiveView (), "GetActiveView");
  137. Assert.AreEqual (1, pmw.Controls.Count, "MultiViewControlsCount");
  138. }
  139. [Test]
  140. public void MultiView_RemoveViewControlEvent ()
  141. {
  142. PokerMultiView pmv = new PokerMultiView ();
  143. View pv1 = new View ();
  144. View pv2 = new View ();
  145. View pv3 = new View ();
  146. pmv.Controls.Add (pv1);
  147. pmv.Controls.Add (pv2);
  148. pmv.Controls.Add (pv3);
  149. pmv.SetActiveView (pv1);
  150. Assert.AreEqual (0, pmv.ActiveViewIndex, "MultiViewActiveView");
  151. Assert.AreEqual (3, pmv.Controls.Count, "MultiViewControlsCount1");
  152. pmv.Controls.Remove (pv1);
  153. Assert.AreEqual (2, pmv.Controls.Count, "MultiViewControlsCount2");
  154. // Protected method MultiView RemovedControl has changed active view to next
  155. Assert.AreSame (pv2, pmv.GetActiveView (), "EventRemovedControl");
  156. }
  157. [Test]
  158. public void MultiView_AddParsedSubObject ()
  159. {
  160. PokerMultiView pmv = new PokerMultiView ();
  161. View v1 = new View ();
  162. pmv.DoAddParsedSubObject (v1);
  163. Assert.AreEqual (1, pmv.Controls.Count, "AddParsedSubObjectSuccssed");
  164. }
  165. [Test]
  166. public void MultiView_CreateControlCollection ()
  167. {
  168. PokerMultiView pmv = new PokerMultiView ();
  169. Assert.IsNotNull (pmv.Views, "CreatingViewCollection");
  170. }
  171. [Test]
  172. public void MultiView_Render ()
  173. {
  174. PokerMultiView b = new PokerMultiView ();
  175. string html = b.Render ();
  176. Assert.AreEqual (b.Render (), string.Empty, "DefaultRender");
  177. }
  178. [Test]
  179. public void MultiView_ButtonRender ()
  180. {
  181. PokerMultiView m = new PokerMultiView ();
  182. PokerView v = new PokerView ();
  183. Button b = new Button ();
  184. b.ID = "test";
  185. v.Controls.Add (b);
  186. m.Controls.Add (v);
  187. m.SetActiveView (v);
  188. string html = m.Render ();
  189. Assert.AreEqual ("<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", html, "ButtonRender");
  190. }
  191. [Test]
  192. public void MultiView_SomeViewsButtonRender ()
  193. {
  194. PokerMultiView m = new PokerMultiView ();
  195. View v = new View ();
  196. View v1 = new View ();
  197. Button b = new Button ();
  198. Button b1 = new Button ();
  199. b1.ID = "test1";
  200. b.ID = "test";
  201. v.Controls.Add (b);
  202. v1.Controls.Add (b1);
  203. m.Controls.Add (v);
  204. m.Controls.Add (v1);
  205. m.SetActiveView (v);
  206. Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test\" value=\"\" id=\"test\" />", "ViewWithButtonRender");
  207. m.SetActiveView (v1);
  208. Assert.AreEqual (m.Render (), "<input type=\"submit\" name=\"test1\" value=\"\" id=\"test1\" />", "ChangeViewButtonRender");
  209. }
  210. [Test]
  211. public void MultiView_ControlState ()
  212. {
  213. PokerMultiView pmv = new PokerMultiView ();
  214. View v1 = new View ();
  215. View v2 = new View ();
  216. View v3 = new View ();
  217. pmv.AddViewCtrl (v1);
  218. pmv.AddViewCtrl (v2);
  219. pmv.AddViewCtrl (v3);
  220. pmv.SetActiveView (v1);
  221. Assert.AreEqual (v1, pmv.GetActiveView (), "BeforeLoadState");
  222. object state = pmv.SaveState ();
  223. pmv.SetActiveView (v2);
  224. Assert.AreEqual (1, pmv.ActiveViewIndex, "AftreSetActiveViewChanged");
  225. pmv.LoadState (state);
  226. Assert.AreEqual (0, pmv.ActiveViewIndex, "AftreLoadState");
  227. }
  228. // Events Stuff
  229. private bool OnActiveChanged;
  230. private void OnActiveViewChangedHandler (object sender, EventArgs e)
  231. {
  232. OnActiveChanged = true;
  233. }
  234. private void ResetEvents ()
  235. {
  236. OnActiveChanged = false;
  237. }
  238. [Test]
  239. public void MultiView_Events ()
  240. {
  241. PokerMultiView pmv = new PokerMultiView ();
  242. pmv.ActiveViewChanged += new EventHandler (OnActiveViewChangedHandler);
  243. Assert.AreEqual (false, OnActiveChanged, "OnActiveChanged");
  244. pmv.DoOnActiveViewChanged (new EventArgs ());
  245. Assert.AreEqual (true, OnActiveChanged, "AfterOnActiveChanged");
  246. }
  247. [Test]
  248. public void MultiView_OnBubbleEvent ()
  249. {
  250. Page myPage = new Page ();
  251. PokerMultiView pmv = new PokerMultiView ();
  252. View v1 = new View ();
  253. View v2 = new View ();
  254. pmv.Controls.Add (v1);
  255. pmv.Controls.Add (v2);
  256. pmv.ActiveViewIndex = 0;
  257. // Command NextView
  258. CommandEventArgs ceaNext = new CommandEventArgs ("NextView", null);
  259. pmv.DoBubbleEvent (this, ceaNext);
  260. Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleEventNext ");
  261. // Command PrevView
  262. CommandEventArgs ceaPrev = new CommandEventArgs ("PrevView", null);
  263. pmv.DoBubbleEvent (this, ceaPrev);
  264. Assert.AreEqual (0, pmv.ActiveViewIndex, "BubbleEventPrev");
  265. // Command SwitchViewByIndex
  266. CommandEventArgs ceaSwitch = new CommandEventArgs ("SwitchViewByIndex", "1");
  267. pmv.DoBubbleEvent (this, ceaSwitch);
  268. Assert.AreEqual (1, pmv.ActiveViewIndex, "BubbleSwitchViewByIndex");
  269. // Command SwitchViewByID
  270. v1.ID = "v1";
  271. myPage.Controls.Add (pmv); // FindControl inherited from control & Page must exist
  272. CommandEventArgs ceaSwitchViewByID = new CommandEventArgs ("SwitchViewByID", "v1");
  273. pmv.DoBubbleEvent (this, ceaSwitchViewByID);
  274. Assert.AreEqual (0, pmv.ActiveViewIndex, "SwitchViewByID");
  275. }
  276. [Test]
  277. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  278. public void MultiView_IndexOutRange ()
  279. {
  280. PokerMultiView pmw = new PokerMultiView ();
  281. View pv1 = new View ();
  282. pmw.Controls.Add (pv1);
  283. pmw.SetActiveView (pv1);
  284. pmw.ActiveViewIndex = 7;
  285. }
  286. [Test]
  287. public void MultiView_AddParsedSubObjectExeption2 ()
  288. {
  289. PokerMultiView pmv = new PokerMultiView ();
  290. LiteralControl l1 = new LiteralControl ("literal");
  291. pmv.DoAddParsedSubObject (l1);
  292. }
  293. //PostBack Events
  294. [Test]
  295. [Category ("NunitWeb")]
  296. public void MultiView_Events_Base_PostBack ()
  297. {
  298. WebTest t = new WebTest ("NoEventValidation.aspx");
  299. t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest));
  300. string html = t.Run ();
  301. if (html.IndexOf ("View_1_is_active") < 0)
  302. Assert.Fail ("MultiView_Events#1 Failed");
  303. FormRequest fr = new FormRequest (t.Response, "form1");
  304. fr.Controls.Add ("bt");
  305. fr.Controls["bt"].Value = "Button";
  306. t.Request = fr;
  307. html = t.Run ();
  308. if (html.IndexOf ("ActiveViewChangedFired") < 0) {
  309. Assert.Fail ("MultiView_Events#3 Failed");
  310. }
  311. if (html.IndexOf ("View_2_is_active") < 0)
  312. Assert.Fail ("MultiView_Events#4 Failed");
  313. }
  314. #region base_events
  315. public static void EventsTest_1 (Page p)
  316. {
  317. MultiView MultiView1 = new MultiView ();
  318. MultiView1.ID = "MultiView1";
  319. View view_1 = new View ();
  320. view_1.ID = "view_1";
  321. View view_2 = new View ();
  322. view_2.ID = "view_2";
  323. Button bt = new Button ();
  324. bt.ID = "bt";
  325. view_1.Controls.Add (bt);
  326. view_1.Controls.Add (new LiteralControl ("View_1_is_active"));
  327. view_2.Controls.Add (new LiteralControl ("View_2_is_active"));
  328. MultiView1.Views.Add (view_1);
  329. MultiView1.Views.Add (view_2);
  330. MultiView1.ActiveViewIndex = 0;
  331. MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged);
  332. p.Controls.Add (MultiView1);
  333. if (p.IsPostBack) {
  334. MultiView1.ActiveViewIndex = 1;
  335. }
  336. }
  337. #endregion
  338. [Test]
  339. [Category ("NunitWeb")]
  340. public void MultiView_Events_NextView_PostBack ()
  341. {
  342. WebTest t = new WebTest ("NoEventValidation.aspx");
  343. t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest));
  344. string html = t.Run ();
  345. if (html.IndexOf ("View_1_is_active") < 0)
  346. Assert.Fail ("MultiView_Events#1 Failed");
  347. FormRequest fr = new FormRequest (t.Response, "form1");
  348. fr.Controls.Add ("bt");
  349. fr.Controls["bt"].Value = "Button";
  350. t.Request = fr;
  351. html = t.Run ();
  352. if (html.IndexOf ("ActiveViewChangedFired") < 0) {
  353. Assert.Fail ("MultiView_Events#3 Failed");
  354. }
  355. if (html.IndexOf ("View_2_is_active") < 0)
  356. Assert.Fail ("MultiView_Events#4 Failed");
  357. }
  358. #region NextView_PostBack
  359. public static void EventsTest (Page p)
  360. {
  361. MultiView MultiView1 = new MultiView ();
  362. MultiView1.ID = "MultiView1";
  363. View view_1 = new View ();
  364. view_1.ID = "view_1";
  365. View view_2 = new View ();
  366. view_2.ID = "view_2";
  367. Button bt = new Button ();
  368. bt.ID = "bt";
  369. bt.CommandName = "NextView";
  370. view_1.Controls.Add (bt);
  371. view_1.Controls.Add (new LiteralControl ("View_1_is_active"));
  372. view_2.Controls.Add (new LiteralControl ("View_2_is_active"));
  373. MultiView1.Views.Add (view_1);
  374. MultiView1.Views.Add (view_2);
  375. MultiView1.ActiveViewIndex = 0;
  376. MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged);
  377. p.Controls.Add (MultiView1);
  378. }
  379. #endregion
  380. [Test]
  381. [Category ("NunitWeb")]
  382. public void MultiView_Events_PrevView_PostBack ()
  383. {
  384. WebTest t = new WebTest ("NoEventValidation.aspx");
  385. t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest_2));
  386. string html = t.Run ();
  387. if (html.IndexOf ("View_2_is_active") < 0)
  388. Assert.Fail ("MultiView_Events#1 Failed");
  389. FormRequest fr = new FormRequest (t.Response, "form1");
  390. fr.Controls.Add ("bt");
  391. fr.Controls["bt"].Value = "Button";
  392. t.Request = fr;
  393. html = t.Run ();
  394. if (html.IndexOf ("ActiveViewChangedFired") < 0) {
  395. Assert.Fail ("MultiView_Events#3 Failed");
  396. }
  397. if (html.IndexOf ("View_1_is_active") < 0)
  398. Assert.Fail ("MultiView_Events#4 Failed");
  399. }
  400. #region PrevView_PostBack
  401. public static void EventsTest_2 (Page p)
  402. {
  403. MultiView MultiView1 = new MultiView ();
  404. MultiView1.ID = "MultiView1";
  405. View view_1 = new View ();
  406. view_1.ID = "view_1";
  407. View view_2 = new View ();
  408. view_2.ID = "view_2";
  409. Button bt = new Button ();
  410. bt.ID = "bt";
  411. bt.CommandName = "PrevView";
  412. view_1.Controls.Add (bt);
  413. view_1.Controls.Add (new LiteralControl ("View_1_is_active"));
  414. view_2.Controls.Add (new LiteralControl ("View_2_is_active"));
  415. MultiView1.Views.Add (view_1);
  416. MultiView1.Views.Add (view_2);
  417. MultiView1.ActiveViewIndex = 1;
  418. MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged);
  419. p.Controls.Add (MultiView1);
  420. }
  421. #endregion
  422. [Test]
  423. [Category ("NunitWeb")]
  424. public void MultiView_Events_SwitchViewByID_PostBack ()
  425. {
  426. WebTest t = new WebTest ("NoEventValidation.aspx");
  427. t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest_3));
  428. string html = t.Run ();
  429. if (html.IndexOf ("View_1_is_active") < 0)
  430. Assert.Fail ("MultiView_Events#1 Failed");
  431. FormRequest fr = new FormRequest (t.Response, "form1");
  432. fr.Controls.Add ("bt");
  433. fr.Controls["bt"].Value = "Button";
  434. t.Request = fr;
  435. html = t.Run ();
  436. if (html.IndexOf ("ActiveViewChangedFired") < 0) {
  437. Assert.Fail ("MultiView_Events#3 Failed");
  438. }
  439. if (html.IndexOf ("View_2_is_active") < 0)
  440. Assert.Fail ("MultiView_Events#4 Failed");
  441. }
  442. #region ByID_PostBack
  443. public static void EventsTest_3 (Page p)
  444. {
  445. MultiView MultiView1 = new MultiView ();
  446. MultiView1.ID = "MultiView1";
  447. View view_1 = new View ();
  448. view_1.ID = "view_1";
  449. View view_2 = new View ();
  450. view_2.ID = "view_2";
  451. Button bt = new Button ();
  452. bt.ID = "bt";
  453. bt.CommandName = "SwitchViewByID";
  454. bt.CommandArgument = "view_2";
  455. view_1.Controls.Add (bt);
  456. view_1.Controls.Add (new LiteralControl ("View_1_is_active"));
  457. view_2.Controls.Add (new LiteralControl ("View_2_is_active"));
  458. MultiView1.Views.Add (view_1);
  459. MultiView1.Views.Add (view_2);
  460. MultiView1.ActiveViewIndex = 0;
  461. MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged);
  462. p.Controls.Add (MultiView1);
  463. }
  464. #endregion
  465. [Test]
  466. [Category ("NunitWeb")]
  467. public void MultiView_Events_SwitchViewByIndex_PostBack ()
  468. {
  469. WebTest t = new WebTest ("NoEventValidation.aspx");
  470. t.Invoker = PageInvoker.CreateOnInit (new PageDelegate (EventsTest_4));
  471. string html = t.Run ();
  472. if (html.IndexOf ("View_1_is_active") < 0)
  473. Assert.Fail ("MultiView_Events#1 Failed");
  474. FormRequest fr = new FormRequest (t.Response, "form1");
  475. fr.Controls.Add ("bt");
  476. fr.Controls["bt"].Value = "Button";
  477. t.Request = fr;
  478. html = t.Run ();
  479. if (html.IndexOf ("ActiveViewChangedFired") < 0) {
  480. Assert.Fail ("MultiView_Events#3 Failed");
  481. }
  482. if (html.IndexOf ("View_2_is_active") < 0)
  483. Assert.Fail ("MultiView_Events#4 Failed");
  484. }
  485. #region SwitchViewByIndex_PostBack
  486. public static void EventsTest_4 (Page p)
  487. {
  488. MultiView MultiView1 = new MultiView ();
  489. MultiView1.ID = "MultiView1";
  490. View view_1 = new View ();
  491. view_1.ID = "view_1";
  492. View view_2 = new View ();
  493. view_2.ID = "view_2";
  494. Button bt = new Button ();
  495. bt.ID = "bt";
  496. bt.CommandName = "SwitchViewByIndex";
  497. bt.CommandArgument = "1";
  498. view_1.Controls.Add (bt);
  499. view_1.Controls.Add (new LiteralControl ("View_1_is_active"));
  500. view_2.Controls.Add (new LiteralControl ("View_2_is_active"));
  501. MultiView1.Views.Add (view_1);
  502. MultiView1.Views.Add (view_2);
  503. MultiView1.ActiveViewIndex = 0;
  504. MultiView1.ActiveViewChanged += new EventHandler (MultiView1_ActiveViewChanged);
  505. p.Controls.Add (MultiView1);
  506. }
  507. #endregion
  508. #region help_event_handler
  509. public static void MultiView1_ActiveViewChanged (object sender, EventArgs e)
  510. {
  511. MultiView mv = sender as MultiView;
  512. if (mv == null)
  513. Assert.Fail ("MultiView_Events#2 Failed");
  514. mv.Page.Controls.Add (new LiteralControl ("ActiveViewChangedFired"));
  515. }
  516. #endregion
  517. }
  518. }
  519. #endif