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


C# PokerGridView.Sort方法代码示例

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


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

示例1: GridView_CreateDataSourceSelectArguments

		public void GridView_CreateDataSourceSelectArguments ()
		{
			DataSourceView view;
			Page p = new Page ();

			PokerGridView g = new PokerGridView ();
			g.Sorting += new GridViewSortEventHandler (g_Sorting);
			p.Controls.Add (g);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (DataSourceObject).AssemblyQualifiedName;
			data.SelectMethod = "GetList";
			data.SortParameterName = "sortExpression";
			DataSourceSelectArguments arg;
			p.Controls.Add (data);

			g.DataSource = data;
			g.DataBind ();

			arg = g.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "Default");

			g.AllowPaging = true;
			g.PageIndex = 2;
			g.PageSize = 3;
			arg = g.DoCreateDataSourceSelectArguments ();
			view = g.DoGetData ();
			Assert.IsFalse (view.CanPage);
			Assert.IsTrue (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = true, CanPage = false, CanRetrieveTotalRowCount = true");

			// make DataSourceView.CanPage = true
			data.EnablePaging = true;

			arg = g.DoCreateDataSourceSelectArguments ();
			view = g.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsFalse (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (new DataSourceSelectArguments (6, -1)), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = false");

			g.AllowPaging = false;
			arg = g.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = false");

			// make DataSourceView.CanRetrieveTotalRowCount = true
			data.SelectCountMethod = "GetCount";

			arg = g.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = true");

			g.AllowPaging = true;
			arg = g.DoCreateDataSourceSelectArguments ();
			DataSourceSelectArguments arg1 = new DataSourceSelectArguments (6, 3);
			arg1.RetrieveTotalRowCount = true;
			view = g.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsTrue (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (arg1), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = true");

			g.AllowPaging = false;
			g.AllowSorting = true;
			g.EditIndex = 2;
			g.PageIndex = 1;
			g.Sort ("sort", SortDirection.Descending);

			Assert.AreEqual (2, g.EditIndex, "EditIndex after Sort, Bound by DataSource");
			Assert.AreEqual (1, g.PageIndex, "PageIndex after Sort, Bound by DataSource");
			
			arg = g.DoCreateDataSourceSelectArguments ();
			view = g.DoGetData ();
			Assert.IsTrue (view.CanSort);
			Assert.AreEqual (String.Empty, g.SortExpression, "SortExpression, Bound by DataSource");
			Assert.AreEqual (SortDirection.Ascending, g.SortDirection, "SortDirection, Bound by DataSource");
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowSorting = true, Bound by DataSource");
		}
开发者ID:nobled,项目名称:mono,代码行数:75,代码来源:GridViewTest.cs

示例2: GridView_Sort

		public void GridView_Sort ()
		{
			PokerGridView g = new PokerGridView ();
			Assert.AreEqual (false, sortingaction, "BeforeSorting");
			g.Sorting += new GridViewSortEventHandler (Gridview_sorting);
			g.Sort("Item",SortDirection.Descending);
			Assert.AreEqual (true, sortingaction, "AfterSorting");
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:GridViewTest.cs

示例3: GridView_Sort_and_DataSourceSelectArguments

		public void GridView_Sort_and_DataSourceSelectArguments ()
		{
			DataSourceView view;
			DataSourceSelectArguments arg;
			Page p = new Page ();

			PokerGridView g = new PokerGridView ();
			g.Columns.Add (new BoundField ());
			g.AllowSorting = true;
			p.Controls.Add (g);

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

			g.DataSourceID = "Data";
			g.EditIndex = 2;
			g.PageIndex = 1;
			g.DataBind ();
			
			g.Sort ("sort", SortDirection.Descending);

			Assert.AreEqual (-1, g.EditIndex, "EditIndex after Sort, Bound by DataSourceID");
			Assert.AreEqual (0, g.PageIndex, "PageIndex after Sort, Bound by DataSourceID");

			arg = g.DoCreateDataSourceSelectArguments();
			view = g.DoGetData ();
			Assert.IsTrue (view.CanSort);
			Assert.AreEqual ("sort", g.SortExpression, "SortExpression, Bound by DataSourceID");
			Assert.AreEqual (SortDirection.Descending, g.SortDirection, "SortDirection, Bound by DataSourceID");
			Assert.AreEqual ("sort DESC", arg.SortExpression, "AllowSorting = true, Bound by DataSourceID");

			g.AllowSorting = false;
			arg = g.DoCreateDataSourceSelectArguments ();
			Assert.AreEqual ("sort DESC", arg.SortExpression, "AllowSorting = false, Bound by DataSourceID");
		}
开发者ID:nobled,项目名称:mono,代码行数:39,代码来源:GridViewTest.cs


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