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


C# WebControls.DataGridPoker类代码示例

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


DataGridPoker类属于MonoTests.System.Web.UI.WebControls命名空间,在下文中一共展示了DataGridPoker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataSourceIDBindingManualColumns

		public void DataSourceIDBindingManualColumns () 
		{
			Page page = new Page ();
			DataGridPoker dg = new DataGridPoker ();
			dg.ID = "DataGrid";
			dg.AutoGenerateColumns = false;
			BoundColumn col = new BoundColumn();
			col.DataField = "something";
			dg.Columns.Add (col);

			page.Controls.Add (dg);

			DataTable dt = new DataTable ();
			dt.Columns.Add (new DataColumn ("something", typeof (Int32)));
			DataRow dr = dt.NewRow ();
			dt.Rows.Add (new object [] { 1 });
			dt.Rows.Add (new object [] { 2 });
			dt.Rows.Add (new object [] { 3 });
			dt.Rows.Add (new object [] { 4 });
			dt.Rows.Add (new object [] { 5 });
			dt.Rows.Add (new object [] { 6 });

			DataView dv = new DataView (dt);

			dg.DataSource = dv;
			dg.DataBind ();

			Assert.AreEqual (1, dg.Columns.Count, "Columns Count");
			Assert.AreEqual (6, dg.Items.Count, "Items Count");
			Assert.AreEqual ("1", dg.Items[0].Cells[0].Text, "Cell content");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:31,代码来源:DataGridTest.cs

示例2: BubbleEvent

		public void BubbleEvent ()
		{
			DataGridPoker p = new DataGridPoker ();
			DataGridCommandEventArgs command_args;

			//
			// Cancel
			//
			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("Cancel", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.CancelCommand += new DataGridCommandEventHandler (CancelCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (cancel_command, "A1");
			Assert.IsTrue (item_command, "#01");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("cancel", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.CancelCommand += new DataGridCommandEventHandler (CancelCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (cancel_command, "A2");
			Assert.IsTrue (item_command, "#02");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("CANCEL", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.CancelCommand += new DataGridCommandEventHandler (CancelCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (cancel_command, "A3");
			Assert.IsTrue (item_command, "#03");

			//
			// Delete
			//
			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("Delete", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.DeleteCommand += new DataGridCommandEventHandler (DeleteCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (delete_command, "A4");
			Assert.IsTrue (item_command, "#04");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("delete", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.DeleteCommand += new DataGridCommandEventHandler (DeleteCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (delete_command, "A5");
			Assert.IsTrue (item_command, "#05");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("DELETE", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.DeleteCommand += new DataGridCommandEventHandler (DeleteCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (delete_command, "A6");
			Assert.IsTrue (item_command, "#06");

			//
			// Edit
			//
			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("Edit", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.EditCommand += new DataGridCommandEventHandler (EditCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (edit_command, "A7");
			Assert.IsTrue (item_command, "#07");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("edit", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.EditCommand += new DataGridCommandEventHandler (EditCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (edit_command, "A8");
			Assert.IsTrue (item_command, "#08");

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
					null, new CommandEventArgs ("EDIT", String.Empty));
			p.ItemCommand += new DataGridCommandEventHandler (ItemCommandHandler);
			p.EditCommand += new DataGridCommandEventHandler (EditCommandHandler);
			p.DoBubbleEvent (this, command_args);
			Assert.IsTrue (edit_command, "A9");
			Assert.IsTrue (item_command, "#09");

			//
			// Item
			//
			ResetEvents ();
			command_args = new DataGridCommandEventArgs (null,
//.........这里部分代码省略.........
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:101,代码来源:DataGridTest.cs

示例3: BadBubblePageArg2

		public void BadBubblePageArg2 ()
		{
			DataGridPoker p = new DataGridPoker ();
			DataGridItem item = new DataGridItem (0, 0, ListItemType.Item);
			DataGridCommandEventArgs command_args;

			ResetEvents ();
			command_args = new DataGridCommandEventArgs (item, null,
					new CommandEventArgs ("Page", new object ()));

			p.DoBubbleEvent (this, command_args);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:12,代码来源:DataGridTest.cs

示例4: SelectItemOutOfRange

		public void SelectItemOutOfRange ()
		{
			DataGridPoker p = new DataGridPoker ();
			DataGridItem d;

			p.SelectedIndex = 25;
			d = p.SelectedItem;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:8,代码来源:DataGridTest.cs

示例5: Styles

		public void Styles ()
		{
			DataGridPoker p = new DataGridPoker ();
			StateBag vs = p.GetViewState ();
			
			p.BackImageUrl = "foobar url";

			// The styles get stored in the view state
			Assert.AreEqual (vs.Count, 0, "A1");
			Assert.IsNull (vs ["BackImageUrl"], "A2");
			Assert.IsNull (vs ["GridLines"], "A3");
			Assert.IsNull (vs ["CellSpacing"], "A4");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:DataGridTest.cs

示例6: SelectedIndexTooLow

		public void SelectedIndexTooLow ()
		{
			DataGridPoker p = new DataGridPoker ();
			p.SelectedIndex = -2;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:5,代码来源:DataGridTest.cs

示例7: ViewState

		public void ViewState ()
		{
			DataGridPoker p = new DataGridPoker ();
			StateBag vs = p.GetViewState ();

			Assert.AreEqual (vs.Count, 0, "A1");

			p.AllowCustomPaging = true;
			Assert.AreEqual (vs.Count, 1, "A2");
			Assert.AreEqual (vs ["AllowCustomPaging"], true, "A3");
			p.AllowCustomPaging = false;
			Assert.AreEqual (vs.Count, 1, "A4");
			Assert.AreEqual (vs ["AllowCustomPaging"], false, "A5");

			p.AllowPaging = true;
			Assert.AreEqual (vs.Count, 2, "A6");
			Assert.AreEqual (vs ["AllowPaging"], true, "A7");
			p.AllowPaging = false;
			Assert.AreEqual (vs.Count, 2, "A8");
			Assert.AreEqual (vs ["AllowPaging"], false, "A9");

			p.AllowSorting = true;
			Assert.AreEqual (vs.Count, 3, "A10");
			Assert.AreEqual (vs ["AllowSorting"], true, "A11");
			p.AllowSorting = false;
			Assert.AreEqual (vs.Count, 3, "A12");
			Assert.AreEqual (vs ["AllowSorting"], false, "A13");

			p.AutoGenerateColumns = true;
			Assert.AreEqual (vs.Count, 4, "A14");
			Assert.AreEqual (vs ["AutoGenerateColumns"], true, "A15");
			p.AutoGenerateColumns = false;
			Assert.AreEqual (vs.Count, 4, "A16");
			Assert.AreEqual (vs ["AutoGenerateColumns"], false, "A17");

			p.CurrentPageIndex = 1;
			Assert.AreEqual (vs.Count, 5, "A18");
			Assert.AreEqual (vs ["CurrentPageIndex"], 1, "A19");

			p.EditItemIndex = 1;
			Assert.AreEqual (vs.Count, 6, "A20");
			Assert.AreEqual (vs ["EditItemIndex"], 1, "A20");

			p.PageSize = 25;
			Assert.AreEqual (vs.Count, 7, "A21");
			Assert.AreEqual (vs ["PageSize"], 25, "A22");

			p.SelectedIndex = 25;
			Assert.AreEqual (vs.Count, 8, "A23");
			Assert.AreEqual (vs ["SelectedIndex"], 25, "A24");

			p.ShowFooter = false;
			Assert.AreEqual (vs.Count, 9, "A25");
			Assert.AreEqual (vs ["ShowFooter"], false, "A26");
			p.ShowFooter = true;
			Assert.AreEqual (vs ["ShowFooter"], true, "A27");

			p.ShowHeader = false;
			Assert.AreEqual (vs.Count, 10, "A28");
			Assert.AreEqual (vs ["ShowHeader"], false, "A29");
			p.ShowHeader = true;
			Assert.AreEqual (vs ["ShowHeader"], true, "A30");

			p.VirtualItemCount = 100;
			Assert.AreEqual (vs.Count, 11, "A31");
			Assert.AreEqual (vs ["VirtualItemCount"], 100, "A32");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:67,代码来源:DataGridTest.cs

示例8: CreationEvents

		public void CreationEvents ()
		{
			DataGridPoker p = new DataGridPoker ();
			DataTable table = new DataTable ();

			table.Columns.Add (new DataColumn ("one", typeof (string)));
			table.Columns.Add (new DataColumn ("two", typeof (string)));
			table.Columns.Add (new DataColumn ("three", typeof (string)));
			
			p.DataSource = new DataView (table);

			p.ItemCreated += new DataGridItemEventHandler (ItemCreatedHandler);
			p.ItemDataBound += new DataGridItemEventHandler (ItemDataBoundHandler);

			// No items added yet
			ResetEvents ();
			p.CreateControls (true);
			Assert.IsTrue (item_created, "A1");
			Assert.IsTrue (item_data_bound, "A2");

			table.Rows.Add (new object [] { "1", "2", "3" });

			ResetEvents ();
			p.CreateControls (true);
			Assert.IsTrue (item_created, "A3");
			Assert.IsTrue (item_data_bound, "A4");

			// no databinding
			ResetEvents ();
			p.CreateControls (false);
			Assert.IsTrue (item_created, "A5");
			Assert.IsFalse (item_data_bound, "A6");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:33,代码来源:DataGridTest.cs

示例9: InitializePager

		public void InitializePager ()
		{
			DataGridPoker p = new DataGridPoker ();
			PagedDataSource paged = new PagedDataSource ();
			DataTable table = new DataTable ();
			DataGridItem item = new DataGridItem (-1, -1, ListItemType.Pager);
			ArrayList columns;
			LinkButton next;
			LinkButton prev;

			table.Columns.Add (new DataColumn ("one", typeof (string)));
			table.Columns.Add (new DataColumn ("two", typeof (string)));
			table.Columns.Add (new DataColumn ("three", typeof (string)));

			for (int i = 0; i < 25; i++)
				table.Rows.Add (new object [] { "1", "2", "3" });
			paged.DataSource = new DataView (table);

			columns = p.CreateColumns (paged, true);
			p.InitPager (item, columns.Count, paged);

			//
			// No where to go
			//

			Assert.AreEqual (item.Controls.Count, 1, "A1");
			Assert.AreEqual (item.Controls [0].GetType (), typeof (TableCell), "A2");
			Assert.AreEqual (item.Controls [0].Controls.Count, 3, "A3");
			Assert.AreEqual (item.Controls [0].Controls [0].GetType (), typeof (Label), "A4");
			Assert.AreEqual (item.Controls [0].Controls [1].GetType (),
					typeof (LiteralControl), "A5");
			Assert.AreEqual (item.Controls [0].Controls [2].GetType (), typeof (Label), "A6");
			Assert.AreEqual (((Label) item.Controls [0].Controls [0]).Text, "&lt;", "A7");
			Assert.AreEqual (((LiteralControl) item.Controls [0].Controls [1]).Text,
					"&nbsp;", "A7");
			Assert.AreEqual (((Label) item.Controls [0].Controls [2]).Text, "&gt;", "A8");

			//
			// Next
			//

			item = new DataGridItem (-1, -1, ListItemType.Pager);
			paged.PageSize = 5;
			paged.VirtualCount = 25;
			paged.AllowPaging = true;
			p.InitPager (item, columns.Count, paged);

			Assert.AreEqual (item.Controls.Count, 1, "A9");
			Assert.AreEqual (item.Controls [0].GetType (), typeof (TableCell), "A10");
			Assert.AreEqual (item.Controls [0].Controls.Count, 3, "A11");
			Assert.AreEqual (item.Controls [0].Controls [0].GetType (), typeof (Label), "A12");
			Assert.AreEqual (item.Controls [0].Controls [1].GetType (),
					typeof (LiteralControl), "A13");
			Assert.AreEqual (((Label) item.Controls [0].Controls [0]).Text, "&lt;", "A14");
			Assert.AreEqual (((LiteralControl) item.Controls [0].Controls [1]).Text,
					"&nbsp;", "A16");

			next = (LinkButton) item.Controls [0].Controls [2];
			Assert.AreEqual (next.Text, "&gt;", "A17");
			Assert.AreEqual (next.CommandName, "Page", "A18");
			Assert.AreEqual (next.CommandArgument, "Next", "A19");


			//
			// Both
			//

			item = new DataGridItem (-1, -1, ListItemType.Pager);
			paged.PageSize = 5;
			paged.VirtualCount = 25;
			paged.AllowPaging = true;
			paged.CurrentPageIndex = 2;
			p.InitPager (item, columns.Count, paged);

			Assert.AreEqual (item.Controls.Count, 1, "A20");
			Assert.AreEqual (item.Controls [0].GetType (), typeof (TableCell), "A21");
			Assert.AreEqual (item.Controls [0].Controls.Count, 3, "A22");
			Assert.AreEqual (item.Controls [0].Controls [1].GetType (),
					typeof (LiteralControl), "A23");
			Assert.AreEqual (((LiteralControl) item.Controls [0].Controls [1]).Text,
					"&nbsp;", "A24");

			// This is failing with an invalidcast right now. It's something related to
			// the pager thinking that it's on the last page and rendering a label instead
			next = (LinkButton) item.Controls [0].Controls [2];
			Assert.AreEqual (next.Text, "&gt;", "A25");
			Assert.AreEqual (next.CommandName, "Page", "A26");
			Assert.AreEqual (next.CommandArgument, "Next", "A27");

			prev = (LinkButton) item.Controls [0].Controls [0];
			Assert.AreEqual (prev.Text, "&lt;", "A28");
			Assert.AreEqual (prev.CommandName, "Page", "A29");
			Assert.AreEqual (prev.CommandArgument, "Prev", "A30");

			//
			// Back only
			//

			item = new DataGridItem (-1, -1, ListItemType.Pager);
			paged.PageSize = 5;
//.........这里部分代码省略.........
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:101,代码来源:DataGridTest.cs

示例10: Defaults

		public void Defaults ()
		{
			DataGridPoker p = new DataGridPoker ();

			Assert.AreEqual (DataGrid.CancelCommandName, "Cancel", "A1");
			Assert.AreEqual (DataGrid.DeleteCommandName, "Delete", "A2");
			Assert.AreEqual (DataGrid.EditCommandName, "Edit", "A3");
			Assert.AreEqual (DataGrid.NextPageCommandArgument, "Next", "A4");
			Assert.AreEqual (DataGrid.PageCommandName, "Page", "A5");
			Assert.AreEqual (DataGrid.PrevPageCommandArgument, "Prev", "A6");
			Assert.AreEqual (DataGrid.SelectCommandName, "Select", "A7");
			Assert.AreEqual (DataGrid.SortCommandName, "Sort", "A8");
			Assert.AreEqual (DataGrid.UpdateCommandName, "Update", "A9");

			Assert.AreEqual (p.AllowCustomPaging, false, "A10");
			Assert.AreEqual (p.AllowPaging, false, "A11");
			Assert.AreEqual (p.AllowSorting, false, "A12");
			Assert.AreEqual (p.AutoGenerateColumns, true, "A13");
			Assert.AreEqual (p.BackImageUrl, String.Empty, "A14");
			Assert.AreEqual (p.CurrentPageIndex, 0, "A15");
			Assert.AreEqual (p.EditItemIndex, -1, "A16");
			Assert.AreEqual (p.PageCount, 0, "A17");
			Assert.AreEqual (p.PageSize, 10, "A18");
			Assert.AreEqual (p.SelectedIndex, -1, "A19");
			Assert.AreEqual (p.SelectedItem, null, "A20");
			Assert.AreEqual (p.ShowFooter, false, "A21");
			Assert.AreEqual (p.ShowHeader, true, "A22");
			Assert.AreEqual (p.VirtualItemCount, 0, "A23");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:29,代码来源:DataGridTest.cs

示例11: CreateControls

		public void CreateControls ()
		{
			DataGridPoker p = new DataGridPoker ();
			DataTable table = new DataTable ();

			table.Columns.Add (new DataColumn ("one", typeof (string)));
			table.Columns.Add (new DataColumn ("two", typeof (string)));
			table.Columns.Add (new DataColumn ("three", typeof (string)));
			table.Rows.Add (new object [] { "1", "2", "3" });
			
			p.DataSource = new DataView (table);

			p.CreateControls (true);
			Assert.AreEqual (p.Controls.Count, 1, "A1");

			ShowControlsRecursive (p.Controls [0], 1);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:17,代码来源:DataGridTest.cs

示例12: OneTemplateColumn3

		public void OneTemplateColumn3 ()
		{
			DataGridPoker p = new DataGridPoker ();
			p.ShowFooter = true;
			p.AutoGenerateColumns = false;
			p.DataSource = new ArrayList ();
			TemplateColumn tc = new TemplateColumn ();
			tc.FooterTemplate = new MyTemplate ("hola");
			p.Columns.Add (tc);
			p.DataBind ();

			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			Assert.AreEqual (1, p.Columns.Count, "columns");
			Assert.AreEqual (1, p.Controls.Count, "controls");

			string render = p.Render ();
			// no items, but we have a footer
			Assert.IsTrue (-1 != render.IndexOf ("hola"), "template");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:20,代码来源:DataGridTest.cs

示例13: OneTemplateColumn2

		public void OneTemplateColumn2 ()
		{
			DataGridPoker p = new DataGridPoker ();
			p.ShowFooter = true;
			p.AutoGenerateColumns = false;
			p.DataSource = new ArrayList ();
			TemplateColumn tc = new TemplateColumn ();
			tc.HeaderText = " ";
			tc.FooterTemplate = new MyTemplate ("hola");
			p.Columns.Add (tc);
			Assert.AreEqual (1, p.Columns.Count, "columns-1");
			Assert.AreEqual (0, p.Controls.Count, "controls-1");
			p.CreateControls (true);
			// This time we have the table there. Thanks to the empty ArrayList
			Assert.AreEqual (1, p.Columns.Count, "columns-2");
			Assert.AreEqual (1, p.Controls.Count, "controls-2");
			p.PrepareCH ();
			Assert.AreEqual (1, p.Columns.Count, "columns-3");
			Assert.AreEqual (1, p.Controls.Count, "controls-3");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:20,代码来源:DataGridTest.cs

示例14: OneTemplateColumn1

		public void OneTemplateColumn1 ()
		{
			DataGridPoker p = new DataGridPoker ();
			TemplateColumn tc = new TemplateColumn ();
			tc.ItemTemplate = new MyTemplate ("hola");
			p.Columns.Add (tc);
			ControlCollection controls = p.Controls;
			p.CreateControls (true);
			Assert.AreEqual (1, p.Columns.Count, "columns");
			Assert.AreEqual (0, controls.Count, "controls");
			string render = p.Render ();
			// no items, even with a templated column.
			// The table is not added if DataSource == null
			Assert.IsTrue (-1 == render.IndexOf ("hola"), "template");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:DataGridTest.cs

示例15: EditItemIndexTooLow

		public void EditItemIndexTooLow ()
		{
			DataGridPoker p = new DataGridPoker ();
			p.EditItemIndex = -2;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:5,代码来源:DataGridTest.cs


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