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


C# DataGridPoker.DataBind方法代码示例

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


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

示例1: SpecialLinkButton1

		public void SpecialLinkButton1 ()
		{
			DataTable dt = new DataTable();
			dt.Columns.Add (new DataColumn("something", typeof(Int32)));
			DataRow dr = dt.NewRow ();
			dt.Rows.Add (new object [] { 1 });
			DataView dv = new DataView (dt);
			DataGridPoker dg = new DataGridPoker ();
			dg.AllowSorting = true;
			dg.HeaderStyle.Font.Bold = true;
			dg.HeaderStyle.ForeColor = Color.FromArgb (255,255,255,255);
			dg.HeaderStyle.BackColor = Color.FromArgb (33,33,33,33);
			dg.DataSource = dv;
			dg.DataBind ();
			LinkButton lb = (LinkButton) FindByType (dg.Controls [0], typeof (LinkButton));
			Assert.IsNotNull (lb, "lb");
			StringWriter sr = new StringWriter ();
			HtmlTextWriter output = new HtmlTextWriter (sr);
			// Nothing here...
			Assert.AreEqual (Color.Empty, lb.ControlStyle.ForeColor, "fore");
			lb.RenderControl (output);
			// Nothing here...
			Assert.AreEqual (Color.Empty, lb.ControlStyle.ForeColor, "fore2");
			dg.Render ();
			// Surprise! after rendering the datagrid, the linkbutton has the ForeColor from the datagrid
			Assert.AreEqual (Color.FromArgb (255,255,255,255), lb.ControlStyle.ForeColor, "fore3");

			// Extra. Items != empty
			Assert.AreEqual (1, dg.Items.Count, "itemCount");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:30,代码来源:DataGridTest.cs

示例2: SpecialLinkButton2

		public void SpecialLinkButton2 ()
		{
			DataTable dt = new DataTable();
			dt.Columns.Add (new DataColumn("string_col", typeof(string)));
			DataRow dr = dt.NewRow ();
			dt.Rows.Add (new object [] { "Item 1" });
			DataView dv = new DataView (dt);

			DataGridPoker dg = new DataGridPoker ();
			dg.DataSource = dv;
			dg.AutoGenerateColumns = false;
			dg.HeaderStyle.ForeColor = Color.FromArgb (255,255,255,255);
			dg.HeaderStyle.BackColor = Color.FromArgb (33,33,33,33);

			ButtonColumn bc = new ButtonColumn ();
			bc.HeaderText = "Some header";
			bc.DataTextField = "string_col";
			bc.CommandName = "lalala";
			dg.Columns.Add (bc);

			BoundColumn bound = new BoundColumn ();
			bound.HeaderText = "The other column";
			bound.DataField = "string_col";
			dg.Columns.Add (bound);

			dg.DataBind ();

			LinkButton lb = (LinkButton) FindByType (dg.Controls [0], typeof (LinkButton));
			Assert.IsNotNull (lb, "lb");
			StringWriter sr = new StringWriter ();
			HtmlTextWriter output = new HtmlTextWriter (sr);
			Assert.AreEqual (Color.Empty, lb.ControlStyle.ForeColor, "fore");
			lb.RenderControl (output);
			Assert.AreEqual (Color.Empty, lb.ControlStyle.ForeColor, "fore2");
			string str = dg.Render ();
			Assert.IsTrue (-1 != str.IndexOf ("<a>Item 1</a>"), "item1");
			Assert.IsTrue (-1 != str.IndexOf ("<td>Item 1</td>"), "item1-2");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:38,代码来源:DataGridTest.cs

示例3: 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

示例4: 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

示例5: DataSourceIDBindingNoColumns

		public void DataSourceIDBindingNoColumns () 
		{
			Page page = new Page ();
			DataGridPoker dg = new DataGridPoker ();
			dg.ID = "DataGrid";
			dg.AutoGenerateColumns = false;

			page.Controls.Add (dg);

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

			dg.DataSourceID = "Data";
			dg.DataBind ();

			Assert.AreEqual (0, dg.Columns.Count, "Columns Count");
			Assert.AreEqual (0, dg.Items.Count, "Items Count");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:22,代码来源:DataGridTest.cs

示例6: DataBindingDataSourceID

		public void DataBindingDataSourceID () 
		{
			Page page = new Page ();
			DataGridPoker dg = new DataGridPoker ();
			page.Controls.Add (dg);

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

			dg.DataSourceID = "Data";
			dg.DataBind ();

			Assert.AreEqual (6, dg.Items.Count, "DataBindingDataSourceID");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:18,代码来源:DataGridTest.cs

示例7: DataSourceAndDataSourceID

		public void DataSourceAndDataSourceID () 
		{
			Page page = new Page ();
			DataGridPoker dg = new DataGridPoker ();
			
			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 });
			DataView dv = new DataView (dt);

			dg.DataSource = dv;

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

			dg.DataSourceID = "Data";

			dg.DataBind ();
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:26,代码来源:DataGridTest.cs


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