當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。