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


C# ObjectDataSourcePoker.Delete方法代碼示例

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


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

示例1: DeleteMethod

		public static void DeleteMethod (Page p)
		{
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			MyTableObject.ds = MyTableObject.CreateDataTable ();  
			DetailsView dv = new DetailsView ();
			ObjectDataSourcePoker ods = new ObjectDataSourcePoker ();
			ods.Deleted += new ObjectDataSourceStatusEventHandler (odc_Deleted);
			ods.Deleting += new ObjectDataSourceMethodEventHandler (odc_Deleting);	
			InitObjectDataSource (ods,"");
			dv.Page = p;
			ods.Page = p;
			dv.DataKeyNames = new string[] { "ID" };
			dv.DataSource = ods;
			p.Controls.Add (lcb); 
			p.Controls.Add (ods);
			p.Controls.Add (dv);
			p.Controls.Add (lce); 
			dv.DataBind ();
			Assert.AreEqual (3, dv.DataItemCount, "BeforeDelete1");
			Assert.AreEqual (1001, dv.SelectedValue, "BeforeDelete2");
			Assert.AreEqual (false, deleting, "BeforeDeletingEvent");
			Assert.AreEqual (false, deleted, "BeforeDeletedEvent");
			ods.Delete ();			
			dv.DataBind ();
			Assert.AreEqual (true, deleting, "AfterDeletingEvent");
			Assert.AreEqual (true, deleted, "AfterDeletedEvent");
			Assert.AreEqual (2, dv.DataItemCount, "BeforeDelete1");
			Assert.AreEqual (1002, dv.SelectedValue, "BeforeDelete2");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:30,代碼來源:ObjectDataSourceTest.cs

示例2: ConvertNullToDBNull

		public static void ConvertNullToDBNull (Page p)
		{
			ObjectDataSourcePoker ods = new ObjectDataSourcePoker ();
			InitObjectDataSource (ods,"DBNull");
			bool dbnull = false;
			ods.ConvertNullToDBNull = true;
			try {
				ods.Delete ();
			}
			catch (Exception ex) {
				Assert.AreEqual (true,
					ex.Message.Contains ("type 'System.DBNull' cannot be converted to type 'System.String'") || // dotnet
					ex.Message.Contains ("type System.DBNull cannot be converted to target type: System.String")); // mono
				dbnull = true;
			}
			Assert.AreEqual (true, dbnull, "ConvertNullToDBNull2");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:17,代碼來源:ObjectDataSourceTest.cs


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