public void GridView_Events () { PokerGridView gv = new PokerGridView (); gv.DataSource = myds; gv.DataBinding += new EventHandler (gv_DataBinding); gv.DataBound += new EventHandler (gv_DataBound); gv.PageIndexChanging += new GridViewPageEventHandler (gv_PageIndexChanging); gv.PageIndexChanged += new EventHandler (gv_PageIndexChanged); gv.PreRender += new EventHandler (gv_PreRender); gv.RowCancelingEdit += new GridViewCancelEditEventHandler (gv_RowCancelingEdit); gv.RowCommand += new GridViewCommandEventHandler (gv_RowCommand); gv.RowCreated += new GridViewRowEventHandler (gv_RowCreated); gv.RowDataBound += new GridViewRowEventHandler (gv_RowDataBound); gv.RowDeleted += new GridViewDeletedEventHandler(gv_RowDeleted); gv.RowDeleting+= new GridViewDeleteEventHandler(gv_RowDeleting); gv.RowEditing+=new GridViewEditEventHandler(gv_RowEditing); gv.RowUpdated+= new GridViewUpdatedEventHandler(gv_RowUpdated); gv.RowUpdating+=new GridViewUpdateEventHandler(gv_RowUpdating); gv.SelectedIndexChanged +=new EventHandler(gv_SelectedIndexChanged); gv.SelectedIndexChanging+=new GridViewSelectEventHandler(gv_SelectedIndexChanging); gv.Sorted +=new EventHandler(gv_Sorted); gv.Sorting +=new GridViewSortEventHandler(gv_Sorting); gv.Unload+=new EventHandler(gv_Unload); Assert.AreEqual (false, dataBinding, "BeforeDataBinding"); gv.DoOnDataBinding (new EventArgs ()); Assert.AreEqual (true, dataBinding, "AfterDataBinding"); Assert.AreEqual (false, dataBound, "BeforeDataBound"); gv.DoOnDataBound (new EventArgs ()); Assert.AreEqual (true, dataBound, "AfterDataBound"); Assert.AreEqual (false, pageIndexChanged, "BeforepageIndexChanged"); gv.DoOnPageIndexChanged (new EventArgs ()); Assert.AreEqual (true, pageIndexChanged, "AfterpageIndexChanged"); ResetEvents (); Assert.AreEqual (false, pageIndexChanging, "BeforepageIndexChanging"); gv.DoOnPageIndexChanging (new GridViewPageEventArgs(1)); Assert.AreEqual (true, pageIndexChanging, "AfterpageIndexChanging"); Assert.AreEqual (false, preRender, "BeforePreRender"); gv.DoOnPreRender (new EventArgs ()); Assert.AreEqual (true, preRender, "AfterPreRender"); ResetEvents (); Assert.AreEqual (false, gridViewCancelEdit, "BeforeGridViewCancelEdit"); gv.DoOnRowCancelingEdit (new GridViewCancelEditEventArgs (1)); Assert.AreEqual (true, gridViewCancelEdit, "AfterGridViewCancelEdit"); ResetEvents (); Assert.AreEqual (false, rowCommand, "BeforeRowCommand"); LinkButton lb= new LinkButton(); gv.DoOnRowCommand (new GridViewCommandEventArgs(lb,new CommandEventArgs("",null))); Assert.AreEqual (true, rowCommand, "AfterRowCommand"); Assert.AreEqual (false, rowCreated, "BeforeRowCreated"); gv.DoOnRowCreated (new GridViewRowEventArgs (gv.SelectedRow)); Assert.AreEqual (true, rowCommand, "AfterRowCreated"); Assert.AreEqual (false, rowDataBound, "BeforeRowDataBound"); gv.DoOnRowDataBound (new GridViewRowEventArgs (gv.SelectedRow)); Assert.AreEqual (true, rowDataBound, "AfterRowDataBound"); Assert.AreEqual (false, rowDeleted, "BeforeRowDeleted"); gv.DoOnRowDeleted(new GridViewDeletedEventArgs(1,new ArgumentException())); Assert.AreEqual (true, rowDeleted, "AfterRowDeleted"); ResetEvents (); Assert.AreEqual (false, rowDeleting, "BeforeRowDeleting"); gv.DoOnRowDeleting (new GridViewDeleteEventArgs (0)); Assert.AreEqual (true, rowDeleting, "AfterRowDeleting"); ResetEvents (); Assert.AreEqual (false, rowEditing, "BeforeRowEditing"); gv.DoOnRowEditing (new GridViewEditEventArgs (0)); Assert.AreEqual (true, rowEditing, "AfterRowEditing"); Assert.AreEqual (false, rowUpdated, "BeforeRowUpdated"); gv.DoOnRowUpdated (new GridViewUpdatedEventArgs(1,new Exception())); Assert.AreEqual (true, rowUpdated, "AfterRowUpdated"); ResetEvents (); Assert.AreEqual (false, rowUpdating, "BeforeRowUpdating"); gv.DoOnRowUpdating (new GridViewUpdateEventArgs (0)); Assert.AreEqual (true, rowUpdating, "AfterRowUpdating"); Assert.AreEqual (false, selectIndexChanged, "BeforeSelectedIndexChanged"); gv.DoOnSelectedIndexChanged (new EventArgs ()); Assert.AreEqual (true, selectIndexChanged, "AfterSelectedIndexChanged"); ResetEvents (); Assert.AreEqual (false, selectIndexChanging, "BeforeSelectedIndexChanging"); gv.DoOnSelectedIndexChanging (new GridViewSelectEventArgs (2)); Assert.AreEqual (true, selectIndexChanging, "AfterSelectedIndexChanging"); Assert.AreEqual (false, sorted, "BeforeSorted"); gv.DoOnSorted (new EventArgs ()); Assert.AreEqual (true, sorted, "AfterSorted"); Assert.AreEqual (false, sorting, "BeforeSorting"); gv.DoOnSorting(new GridViewSortEventArgs("",SortDirection.Ascending)); Assert.AreEqual (true, sorting, "AfterSorting"); Assert.AreEqual (false, unload, "BeforeUnload"); gv.DoOnUnload (new EventArgs ()); Assert.AreEqual (true, unload, "AfterUnload"); }