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


C# TestDataList.DataBind方法代碼示例

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


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

示例1: SelectedValue_SelectedIndex

		public void SelectedValue_SelectedIndex ()
		{
			// Test for bug https://bugzilla.novell.com/show_bug.cgi?id=376519
			DataTable table = new DataTable();
			table.Columns.Add("id");
			table.Columns.Add("text");

			table.Rows.Add(new object[] {"id1", "Item N1"});
			table.Rows.Add(new object[] {"id2", "Item N2"});
			table.Rows.Add(new object[] {"id3", "Item N3"});
			
			TestDataList dl = new TestDataList ();
			dl.DataKeyField = "id";
			dl.DataSource = table;
			dl.DataBind ();

			Assert.AreEqual (null, dl.SelectedValue, "A1");
			dl.SelectedIndex = 0;
			Assert.AreEqual ("id1", dl.SelectedValue.ToString (), "A2");
		}		
開發者ID:whereisaaron,項目名稱:mono,代碼行數:20,代碼來源:DataListTest.cs

示例2: Controls

		public void Controls ()
		{
			TestDataList dl = new TestDataList ();
			Assert.AreEqual (0, dl.Controls.Count, "Controls-1");
			Assert.AreEqual (0, dl.Items.Count, "Items-1");
			dl.DataSource = GetDataSource (3);
			Assert.AreEqual (0, dl.Controls.Count, "Controls-2");
			Assert.AreEqual (0, dl.Items.Count, "Items-2");
			dl.DataBind ();
			Assert.AreEqual (0, dl.Controls.Count, "Controls-3");
			Assert.AreEqual (0, dl.Items.Count, "Items-3");
		}
開發者ID:whereisaaron,項目名稱:mono,代碼行數:12,代碼來源:DataListTest.cs

示例3: RepeatedItemCount

		public void RepeatedItemCount ()
		{
			TestDataList dl = new TestDataList ();
			IRepeatInfoUser riu = (dl as IRepeatInfoUser);
			dl.DataSource = GetData (10);
			Assert.AreEqual (0, riu.RepeatedItemCount, "before Bind");
			dl.DataBind ();
			Assert.AreEqual (10, riu.RepeatedItemCount, "after Bind");
		}
開發者ID:whereisaaron,項目名稱:mono,代碼行數:9,代碼來源:DataListTest.cs

示例4: GetItemStyle_Separator

		public void GetItemStyle_Separator ()
		{
			TestDataList dl = new TestDataList ();
			dl.DataSource = GetData (6);
			dl.DataBind ();
			IRepeatInfoUser riu = (dl as IRepeatInfoUser);
			Assert.IsNull (riu.GetItemStyle (ListItemType.Separator, 0));
		}
開發者ID:whereisaaron,項目名稱:mono,代碼行數:8,代碼來源:DataListTest.cs

示例5: ProperTemplateSelectedIndexEqualsEditIndex

		public void ProperTemplateSelectedIndexEqualsEditIndex ()
		{
			TestDataList dl = new TestDataList();
			dl.ItemTemplate = new ItemTemplate();
			dl.AlternatingItemTemplate = new ItemTemplate();
			dl.SelectedItemTemplate = new ItemTemplate();
			dl.EditItemTemplate = new EditItemTemplate();
			dl.DataSource = GetData(5);
			dl.SelectedIndex = 0;
			dl.EditItemIndex = 0;
			dl.DataBind();
			object canIGetMyEditItem = dl.Items[dl.EditItemIndex].FindControl("eitemtmpl");
			Assert.IsTrue(canIGetMyEditItem != null, "ProperTemplateSelectedIndexEqualsEditIndex");
		}
開發者ID:whereisaaron,項目名稱:mono,代碼行數:14,代碼來源:DataListTest.cs


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