當前位置: 首頁>>代碼示例>>C#>>正文


C# DataGridPoker.Render方法代碼示例

本文整理匯總了C#中MonoTests.System.Web.UI.WebControls.DataGridPoker.Render方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGridPoker.Render方法的具體用法?C# DataGridPoker.Render怎麽用?C# DataGridPoker.Render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoTests.System.Web.UI.WebControls.DataGridPoker的用法示例。


在下文中一共展示了DataGridPoker.Render方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

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

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

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

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

			Assert.AreEqual (p.Render (), String.Empty, "A1");
		}
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:6,代碼來源:DataGridTest.cs

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


注:本文中的MonoTests.System.Web.UI.WebControls.DataGridPoker.Render方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。