当前位置: 首页>>代码示例>>C#>>正文


C# PokerGridView.DoSaveControlState方法代码示例

本文整理汇总了C#中MonoTests.System.Web.UI.WebControls.PokerGridView.DoSaveControlState方法的典型用法代码示例。如果您正苦于以下问题:C# PokerGridView.DoSaveControlState方法的具体用法?C# PokerGridView.DoSaveControlState怎么用?C# PokerGridView.DoSaveControlState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoTests.System.Web.UI.WebControls.PokerGridView的用法示例。


在下文中一共展示了PokerGridView.DoSaveControlState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GridView_PageCount

		public void GridView_PageCount ()
		{
			Page p = new Page ();

			PokerGridView gv = new PokerGridView ();
			gv.PageSize = 3;
			gv.AllowPaging = true;
			p.Controls.Add (gv);

			ObjectDataSource data = new ObjectDataSource ();
			data.ID = "ObjectDataSource1";
			data.TypeName = typeof (DataSourceObject).AssemblyQualifiedName;
			data.SelectMethod = "GetList";
			p.Controls.Add (data);

			gv.DataSourceID = "ObjectDataSource1";
			gv.SetRequiresDataBinding (true);

			Assert.AreEqual (0, gv.PageCount, "PageCount before binding");

			gv.DataBind ();

			Assert.AreEqual (2, gv.PageCount, "PageCount after binding");

			PokerGridView copy = new PokerGridView ();
			copy.DoLoadControlState (gv.DoSaveControlState ());

			Assert.AreEqual (2, copy.PageCount, "PageCount from ViewState");
		}
开发者ID:nobled,项目名称:mono,代码行数:29,代码来源:GridViewTest.cs

示例2: GridView_DataKeys

		public void GridView_DataKeys ()
		{
			Page p = new Page ();

			PokerGridView gv = new PokerGridView ();
			p.Controls.Add (gv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (DataObject).AssemblyQualifiedName;
			data.SelectMethod = "Select";
			p.Controls.Add (data);

			gv.DataSource = data;
			gv.DataKeyNames = new string [] { "ID", "FName" };

			DataKeyArray keys1 = gv.DataKeys;

			Assert.AreEqual (0, keys1.Count, "DataKeys count before binding");

			gv.DataBind ();

			DataKeyArray keys2 = gv.DataKeys;
			DataKeyArray keys3 = gv.DataKeys;

			Assert.IsFalse (Object.ReferenceEquals (keys1, keys2), "DataKey returns the same instans");
			Assert.IsTrue (Object.ReferenceEquals (keys2, keys3), "DataKey returns the same instans");

			Assert.AreEqual (1, keys1.Count, "DataKeys count after binding");
			Assert.AreEqual (1001, keys1 [0].Value, "DataKey.Value after binding");
			Assert.AreEqual (2, keys1 [0].Values.Count, "DataKey.Values count after binding");
			Assert.AreEqual (1001, keys1 [0].Values [0], "DataKey.Values[0] after binding");
			Assert.AreEqual ("Mahesh", keys1 [0].Values [1], "DataKey.Values[1] after binding");

			PokerGridView copy = new PokerGridView ();
			object state = gv.DoSaveControlState ();
			copy.DoLoadControlState (state);

			DataKeyArray keys4 = copy.DataKeys;

			Assert.AreEqual (1, keys4.Count, "DataKeys count from ControlState");
			Assert.AreEqual (1001, keys4 [0].Value, "DataKey.Value from ControlState");
			Assert.AreEqual (2, keys4 [0].Values.Count, "DataKey.Values count from ControlState");
			Assert.AreEqual (1001, keys4 [0].Values [0], "DataKey.Values[0] from ControlState");
			Assert.AreEqual ("Mahesh", keys4 [0].Values [1], "DataKey.Values[1] from ControlState");
		}
开发者ID:nobled,项目名称:mono,代码行数:45,代码来源:GridViewTest.cs

示例3: GridView_State

		public void GridView_State ()
		{
			PokerGridView g = new PokerGridView ();
			PokerGridView copy = new PokerGridView ();

			string[] test = new String[1];
			test[0] = "test";
			g.DataKeyNames = test;
			g.EditIndex = 0;
			g.PageIndex = 2;
					
			object state = g.DoSaveControlState ();
			copy.DoLoadControlState (state);

			Assert.AreEqual ("test", copy.DataKeyNames[0], "DataKeyNames");
			Assert.AreEqual (0, copy.EditIndex, "EditIndex");
			Assert.AreEqual (2, copy.PageIndex, "PageIndex");
			
		}
开发者ID:nobled,项目名称:mono,代码行数:19,代码来源:GridViewTest.cs


注:本文中的MonoTests.System.Web.UI.WebControls.PokerGridView.DoSaveControlState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。