public static void DetailsView_DeleteItem (Page p) { LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG); LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG); PokerDetailsView dv = new PokerDetailsView (); ObjectDataSource ds = new ObjectDataSource (); ds.ID = "ObjectDataSource1"; ds.TypeName = "MonoTests.System.Web.UI.WebControls.TableObject"; ds.SelectMethod = "GetMyData"; ds.DeleteMethod = "Delete"; ds.InsertMethod = "Insert"; ds.UpdateMethod = "Update"; Parameter p1 = new Parameter ("ID", TypeCode.String); Parameter p2 = new Parameter ("FName", TypeCode.String); Parameter p3 = new Parameter ("LName", TypeCode.String); ds.DeleteParameters.Add (p1); ds.DeleteParameters.Add (p2); ds.DeleteParameters.Add (p3); dv.Page = p; ds.Page = p; p.Form.Controls.Add (lcb); p.Form.Controls.Add (dv); p.Form.Controls.Add (ds); p.Form.Controls.Add (lce); dv.AllowPaging = true; dv.DataKeyNames = new string[] { "ID", "FName", "LName" }; dv.DataSourceID = "ObjectDataSource1"; dv.DataBind (); dv.DeleteItem (); }
public void DetailsView_DeleteItemHandler () { PokerDetailsView dv = new PokerDetailsView (); dv.DataSource = myds; dv.DataBind (); Assert.AreEqual (false, isDeleted, "BeforeDeleteItem"); dv.ItemDeleting += new DetailsViewDeleteEventHandler (dv_DeleteingHandler); dv.DeleteItem (); Assert.AreEqual (true, isDeleted, "BeforeDeleteItem"); }