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


C# Poker.DataBind方法代码示例

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


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

示例1: FormView_DataBind

		public void FormView_DataBind ()
		{
			Poker fv = new Poker ();
			fv.AllowPaging = true;
			fv.DataSource = myds;
			fv.Page = new Page ();
			Assert.AreEqual (0, fv.PageCount, "BeforeDataBind1");
			Assert.AreEqual (null, fv.DataItem, "BeforeDataBind2");
			fv.DataBind ();
			Assert.AreEqual (6, fv.PageCount, "AfterDataBind1");
			Assert.AreEqual (6, fv.DataItemCount, "AfterDataBind2");
			Assert.AreEqual ("Item1", fv.DataItem, "AfterDataBind3");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:13,代码来源:FormViewTest.cs

示例2: FormView_PageCount

		public void FormView_PageCount () {
			Page p = new Page ();

			Poker fv = new Poker ();
			p.Controls.Add (fv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (FormViewDataObject).AssemblyQualifiedName;
			data.SelectMethod = "Select";
			p.Controls.Add (data);

			fv.DataSource = data;

			Assert.AreEqual (0, fv.PageCount, "PageCount before binding");

			fv.DataBind ();
			
			Assert.AreEqual (3, fv.PageCount, "PageCount after binding");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:19,代码来源:FormViewTest.cs

示例3: FormView_DataKey

		public void FormView_DataKey ()
		{
			Page p = new Page ();

			Poker fv = new Poker ();
			p.Controls.Add (fv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (FormViewDataObject).AssemblyQualifiedName;
			data.SelectMethod = "Select";
			p.Controls.Add (data);

			fv.DataSource = data;
			fv.DataKeyNames = new string [] { "ID", "FName" };

			DataKey key1 = fv.DataKey;

			Assert.AreEqual (null, key1.Value, "DataKey.Value before binding");
			Assert.AreEqual (0, key1.Values.Count, "DataKey.Values count before binding");

			fv.DataBind ();

			DataKey key2 = fv.DataKey;
			DataKey key3 = fv.DataKey;

			Assert.IsFalse (Object.ReferenceEquals (key1, key2), "DataKey returns the same instans");
			Assert.IsTrue (Object.ReferenceEquals (key2, key3), "DataKey returns the same instans");
			
			Assert.AreEqual (1001, key1.Value, "DataKey.Value after binding");
			Assert.AreEqual (2, key1.Values.Count, "DataKey.Values count after binding");
			Assert.AreEqual (1001, key1.Values [0], "DataKey.Values[0] after binding");
			Assert.AreEqual ("Mahesh", key1.Values [1], "DataKey.Values[1] after binding");

			Poker copy = new Poker ();
			object state = fv.DoSaveControlState ();
			copy.DoLoadControlState (state);

			DataKey key4 = copy.DataKey;

			Assert.AreEqual (1001, key4.Value, "DataKey.Value from ViewState");
			Assert.AreEqual (2, key4.Values.Count, "DataKey.Values count from ViewState");
			Assert.AreEqual (1001, key4.Values [0], "DataKey.Values[0] from ViewState");
			Assert.AreEqual ("Mahesh", key4.Values [1], "DataKey.Values[1] from ViewState");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:44,代码来源:FormViewTest.cs

示例4: FormView_CreateTable

		public void FormView_CreateTable ()
		{
			Poker fv = new Poker ();
			Table tb = fv.DoCreateTable ();
			fv.Page = new Page ();
			Assert.AreEqual ("", tb.BackImageUrl , "CreateTable1");
			Assert.AreEqual (0, tb.Rows.Count, "CreateTable2");
			fv.DataSource = myds;
			fv.DataBind ();			
			fv.ID = "TestFormView";
			tb = fv.DoCreateTable ();
			Assert.AreEqual (-1, tb.CellPadding , "CreateTable3");			

		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:14,代码来源:FormViewTest.cs

示例5: FormView_PrepareControlHierarchy

		public void FormView_PrepareControlHierarchy ()
		{
			Poker fv = new Poker ();
			fv.Page = new Page ();
			fv.controlHierarchy = false;
			fv.Render ();
			Assert.AreEqual (0, fv.Controls.Count, "ControlHierarchy1");
			Assert.AreEqual (true, fv.controlHierarchy, "ControlHierarchy2");
			fv.AllowPaging = true;
			fv.DataSource = myds;
			fv.DataBind ();
			fv.controlHierarchy = false;
			fv.Render ();
			Assert.AreEqual (1, fv.Controls.Count, "ControlHierarchy3");
			Assert.AreEqual (true, fv.controlHierarchy, "ControlHierarchy4");


		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:18,代码来源:FormViewTest.cs

示例6: PerformDataBind_PerformSelect

		public void PerformDataBind_PerformSelect ()
		{
			Poker p = new Poker ();
			p.DataBind ();
			string html = p.Render ();
#region #1
			string orig = "<select type=\"MyType\" name=\"MyName\" value=\"MyValue\">\n\t<option selected=\"selected\" value=\"1\">1</option>\n\t<option value=\"2\">2</option>\n\t<option value=\"3\">3</option>\n\n</select>";
#endregion
			HtmlDiff.AssertAreEqual (orig, html, "PerformDataBind");
		}
开发者ID:nobled,项目名称:mono,代码行数:10,代码来源:ListControlTest.cs

示例7: FormView_CreateRow

		public void FormView_CreateRow ()
		{
			Poker fv = new Poker ();
			fv.AllowPaging =true;
			fv.DataSource = myds;
			fv.Page = new Page ();
			fv.DataBind ();
			FormViewRow row = fv.DoCreateRow (2,DataControlRowType.DataRow ,DataControlRowState.Normal );
			Assert.AreEqual (2, row.ItemIndex, "CreatedRowItemIndex1");
			Assert.AreEqual (DataControlRowState.Normal , row.RowState, "CreatedRowState1");
			Assert.AreEqual (DataControlRowType.DataRow , row.RowType, "CreatedRowType1");			 
			row = fv.DoCreateRow (4, DataControlRowType.Footer, DataControlRowState.Edit);
			Assert.AreEqual (4, row.ItemIndex, "CreatedRowItemIndex2");
			Assert.AreEqual (DataControlRowState.Edit , row.RowState, "CreatedRowState2");
			Assert.AreEqual (DataControlRowType.Footer , row.RowType, "CreatedRowType2");
			//FormViewPagerRow pagerRow = (FormViewPagerRow)fv.DoCreateRow (3, DataControlRowType.Pager , DataControlRowState.Insert);
			//Assert.AreEqual (3, pagerRow.ItemIndex, "CreatedPageRowItemIndex");
			//Assert.AreEqual (DataControlRowState.Insert, pagerRow.RowState, "CreatedPageRowState");
			//Assert.AreEqual (DataControlRowType.Pager, pagerRow.RowType, "CreatedPageRowType");			 
			
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:FormViewTest.cs

示例8: FormView_ItemsProperties

		public void FormView_ItemsProperties ()
		{
			Poker p = new Poker ();
			p.Page = new Page ();
			p.AllowPaging = true;
			p.DataSource = myds;
			p.DataBind ();
			//Assert.AreEqual (typeof (FormViewPagerRow), (p.BottomPagerRow).GetType (), "BottomPagerRow1");
			Assert.AreEqual (0, p.BottomPagerRow.ItemIndex, "BottomPagerRow2");
			Assert.AreEqual (DataControlRowType.Pager, p.BottomPagerRow.RowType, "BottomPagerRow2");
			Assert.AreEqual ("Item1", p.DataItem, "DataItem");
			Assert.AreEqual (6, p.DataItemCount, "DataItemCount");
			Assert.AreEqual (0, p.DataItemIndex, "DataItemIndex");
			Assert.AreEqual (0, p.DataItemIndex, "DataItemIndex");
			string[] str = new string[] { "1", "2", "3", "4", "5", "6" };
			Assert.AreEqual (typeof (DataKey), p.DataKey.GetType (), "DataKey");
			p.DataKeyNames = str;
			Assert.AreEqual (str, p.DataKeyNames, "DataKeyNames");
			p.ChangeMode (FormViewMode.Edit);
			Assert.AreEqual (FormViewMode.Edit, p.CurrentMode, "CurrentModeEdit");
			p.ChangeMode (FormViewMode.Insert);
			Assert.AreEqual (FormViewMode.Insert, p.CurrentMode, "CurrentModeInsert");

		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:24,代码来源:FormViewTest.cs

示例9: FormView_CreateChildControls2

		public void FormView_CreateChildControls2 ()
		{
			Poker fv = new Poker ();
			fv.Page = new Page ();
			fv.DataSource = new MyEnumSource (20);
			fv.DataBind ();
			
			Assert.AreEqual (20, fv.PageCount, "CreateChildControls#0");

			Assert.AreEqual (0, fv.DoCreateChildControls (new MyEnumSource (0), true), "CreateChildControls#1");
			Assert.AreEqual (20, fv.DoCreateChildControls (new MyEnumSource (20), true), "CreateChildControls#2");

			Assert.AreEqual (0, fv.DoCreateChildControls (new object [0], false), "CreateChildControls#3");
			Assert.AreEqual (5, fv.DoCreateChildControls (new object [5], false), "CreateChildControls#4");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:FormViewTest.cs

示例10: FormView_CreateDataSourceSelectArguments2

		public void FormView_CreateDataSourceSelectArguments2 () {
			DataSourceView view;
			Page p = new Page ();

			Poker dv = new Poker ();
			p.Controls.Add (dv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (DataSourceObject).AssemblyQualifiedName;
			data.SelectMethod = "GetList";
			data.SortParameterName = "sortExpression";
			DataSourceSelectArguments arg;
			p.Controls.Add (data);

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

			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "Default");

			dv.AllowPaging = true;
			dv.PageIndex = 2;
			arg = dv.DoCreateDataSourceSelectArguments ();
			view = dv.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 = dv.DoCreateDataSourceSelectArguments ();
			view = dv.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsFalse (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (new DataSourceSelectArguments (2, -1)), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = false");

			dv.AllowPaging = false;
			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = false");

			// make DataSourceView.CanRetrieveTotalRowCount = true
			data.SelectCountMethod = "GetCount";

			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = true");

			dv.AllowPaging = true;
			arg = dv.DoCreateDataSourceSelectArguments ();
			DataSourceSelectArguments arg1 = new DataSourceSelectArguments (2, 1);
			arg1.RetrieveTotalRowCount = true;
			view = dv.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsTrue (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (arg1), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = true");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:56,代码来源:FormViewTest.cs

示例11: FormView_RequiresDataBinding_LoadComplete

		public static void FormView_RequiresDataBinding_LoadComplete (Page p) {
			Poker view = new Poker ();
			p.Form.Controls.Add (view);

			view.DataSource = new string [] { "A", "B", "C" };
			view.DataBind ();

			Assert.AreEqual (false, view.GetRequiresDataBinding ());

			view.PagerTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "PagerTemplate was set");

			view.EmptyDataTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "EmptyDataTemplate was set");

			view.HeaderTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "HeaderTemplate was set");

			view.FooterTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "FooterTemplate was set");

			view.EditItemTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "EditItemTemplate was set");

			view.InsertItemTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "InsertItemTemplate was set");

			view.ItemTemplate = new CompiledTemplateBuilder (BuildTemplateMethod);
			Assert.AreEqual (false, view.GetRequiresDataBinding (), "ItemTemplate was set");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:30,代码来源:FormViewTest.cs

示例12: FormView_BubbleEvent

		public void FormView_BubbleEvent ()
		{
			FormViewCommandEventArgs com;
			Poker fv = new Poker ();
			Page page = new Page ();
			Button bt = new Button ();
			fv.AllowPaging = true;
			fv.DataSource = myds;
			page.Controls.Add (fv);
			fv.DataBind ();
			ResetEvents ();
			fv.ItemCommand += new FormViewCommandEventHandler (fv_ItemCommand);
			fv.ItemDeleted += new FormViewDeletedEventHandler (fv_ItemDeleted);
			//Delete
			fv.ItemDeleting += new FormViewDeleteEventHandler (fv_ItemDeleting);
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Delete", null));
			Assert.AreEqual (false, itemDeleting, "BeforeDeleteCommandBubbleEvent");
			Assert.AreEqual (false, itemCommand, "BeforeDeleteBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Delete");
			Assert.AreEqual (true, itemDeleting, "AfterDeleteBubbleEvent");
			Assert.AreEqual (true, itemCommand, "AfterDeleteCommandBubbleEvent");


			//Insert
			itemCommand = false;
			fv.ItemInserting += new FormViewInsertEventHandler (fv_ItemInserting);
			fv.ChangeMode (FormViewMode.Insert);
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Insert", null));
			Assert.AreEqual (false, itemCommand, "BeforeInsertCommandBubbleEvent");
			Assert.AreEqual (false, itemInserting, "BeforeInsertBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Insert");
			Assert.AreEqual (true, itemCommand, "AfterInsertCommandBubbleEvent");
			Assert.AreEqual (true, itemInserting, "AfterInsertBubbleEvent");


			//Update
			itemCommand = false;
			fv.ItemUpdating += new FormViewUpdateEventHandler (fv_ItemUpdating);
			fv.ChangeMode (FormViewMode.Edit);
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Update", null));
			Assert.AreEqual (false, itemUpdating, "BeforeUpdateEvent");
			Assert.AreEqual (false, itemCommand, "BeforeUpdateCommandEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Update");
			Assert.AreEqual (true, itemCommand, "AfterUpdateCommandBubbleEvent");
			Assert.AreEqual (true, itemUpdating, "AfterUpdateBubbleEvent");


			//Cancel 
			itemCommand = false;
			fv.ModeChanging += new FormViewModeEventHandler (fv_ModeChanging);
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Cancel", null));
			Assert.AreEqual (false, itemCommand, "BeforeCancelCommandBubbleEvent");
			Assert.AreEqual (false, modeChanging, "BeforeCancelBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Cancel");
			Assert.AreEqual (true, itemCommand, "AfterCancelCommandBubbleEvent");
			Assert.AreEqual (true, modeChanging, "AfterCancelBubbleEvent");

			//Edit
			itemCommand = false;
			modeChanging = false;
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Edit", null));
			Assert.AreEqual (false, itemCommand, "BeforeEditCommandBubbleEvent");
			Assert.AreEqual (false, modeChanging, "BeforeEditBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Edit");
			Assert.AreEqual (true, itemCommand, "AfterEditCommandBubbleEvent");
			Assert.AreEqual (true, modeChanging, "AfterEditBubbleEvent");

			//New
			itemCommand = false;
			modeChanging = false;
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("New", null));
			Assert.AreEqual (false, itemCommand, "BeforeNewCommandBubbleEvent");
			Assert.AreEqual (false, modeChanging, "BeforeNewBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - New");
			Assert.AreEqual (true, itemCommand, "AfterNewCommandBubbleEvent");
			Assert.AreEqual (true, modeChanging, "AfterNewBubbleEvent");

			//Page Index default
			itemCommand = false;
			fv.PageIndexChanging += new FormViewPageEventHandler (fv_PageIndexChanging);
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Page", null));
			Assert.AreEqual (false, itemCommand, "BeforePageCommandBubbleEvent");
			Assert.AreEqual (false, pageIndexChanging, "BeforePageBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Page Index default");
			Assert.AreEqual (true, itemCommand, "AfterPageCommandBubbleEvent");
			Assert.AreEqual (true, pageIndexChanging, "AfterPageBubbleEvent");
			Assert.AreEqual (-1, newPageIndex, "PageIndex");

			//Next Page
			itemCommand = false;
			pageIndexChanging = false;
			com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Page", "Next"));
			Assert.AreEqual (false, itemCommand, "BeforeNextPageCommandBubbleEvent");
			Assert.AreEqual (false, pageIndexChanging, "BeforeNextPageBubbleEvent");
			Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Next Page");
			Assert.AreEqual (true, itemCommand, "AfterNextPageCommandBubbleEvent");
			Assert.AreEqual (true, pageIndexChanging, "AfterNextPageBubbleEvent");
			Assert.AreEqual (1, newPageIndex, "NextPageIndex");

			//Prev Page
//.........这里部分代码省略.........
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:101,代码来源:FormViewTest.cs

示例13: DataBind

		public void DataBind ()
		{
			Poker p = new Poker ();
			p.DataSourceID = "DataSourceID";
			p.SetRequiresDataBinding (true);
			p.DataBind ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:BaseDataBoundControlTest.cs

示例14: DataBind

		public void DataBind ()
		{
			Page p = new Page ();
			
			ObjectDataSource ods = new ObjectDataSource (typeof (Control).FullName, "ToString");
			ods.ID = "ObjectDataSource1";
			p.Controls.Add (ods);
			
			Poker c = new Poker ();
			c.DataSourceID = "ObjectDataSource1";
			c.SetRequiresDataBinding (true);
			p.Controls.Add (c);
			
			c.DataBind ();
		}
开发者ID:nobled,项目名称:mono,代码行数:15,代码来源:DataBoundControlTest.cs

示例15: FormView_DeleteItem

		public void FormView_DeleteItem ()
		{
			Poker fv = new Poker ();
			fv.Page = new Page ();
			fv.DataSource = myds;
			fv.DataBind ();
			Assert.AreEqual (false, isDeleted, "BeforeDeleteItem");
			fv.ItemDeleting += new FormViewDeleteEventHandler (fv_DeleteingHandler);
			fv.DeleteItem ();
			Assert.AreEqual (true, isDeleted, "BeforeDeleteItem");

		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:12,代码来源:FormViewTest.cs


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