本文整理汇总了C#中PokerDetailsView.ChangeMode方法的典型用法代码示例。如果您正苦于以下问题:C# PokerDetailsView.ChangeMode方法的具体用法?C# PokerDetailsView.ChangeMode怎么用?C# PokerDetailsView.ChangeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PokerDetailsView
的用法示例。
在下文中一共展示了PokerDetailsView.ChangeMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetailsView_UpdateItem
public void DetailsView_UpdateItem ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.ChangeMode (DetailsViewMode.Edit);
dv.Page = new Page ();
dv.Page.Validate ();
dv.ItemUpdating += new DetailsViewUpdateEventHandler (update_item);
Assert.AreEqual (false, updateItem, "BeforeUpdateItem");
dv.UpdateItem (true);
Assert.AreEqual (true, updateItem, "AfterUpdateItem");
}
示例2: DetailsView_InsertItem
public void DetailsView_InsertItem ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.Page = new Page ();
dv.Page.Validate();
dv.ChangeMode (DetailsViewMode.Insert);
dv.ItemInserting += new DetailsViewInsertEventHandler (insert_item);
Assert.AreEqual (false, insertItem, "BeforeInsertItem");
dv.InsertItem (true);
Assert.AreEqual (true, insertItem, "AfterInsertItem");
}
示例3: DetailsView_ChangeMode
public void DetailsView_ChangeMode ()
{
PokerDetailsView dv = new PokerDetailsView ();
Assert.AreEqual (DetailsViewMode.ReadOnly, dv.CurrentMode, "ChangeModeDefault");
dv.ChangeMode (DetailsViewMode.Insert);
Assert.AreEqual (DetailsViewMode.Insert, dv.CurrentMode, "ChangeModeInsert");
dv.ChangeMode (DetailsViewMode.Edit);
Assert.AreEqual (DetailsViewMode.Edit, dv.CurrentMode, "ChangeModeEdit");
dv.ChangeMode (DetailsViewMode.ReadOnly);
Assert.AreEqual (DetailsViewMode.ReadOnly, dv.CurrentMode, "ChangeModeReadOnly");
}
示例4: DetailsView_AssignToDefaultProperties
public void DetailsView_AssignToDefaultProperties ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.AllowPaging = true;
dv.DataSource = myds;
dv.DataBind ();
Assert.AreEqual (true, dv.AllowPaging, "AllowPaging");
dv.AlternatingRowStyle.CssClass = "style.css";
Assert.AreEqual ("style.css", dv.AlternatingRowStyle.CssClass, "AlternatingRowStyle");
dv.AutoGenerateDeleteButton = true;
Assert.AreEqual (true, dv.AutoGenerateDeleteButton, "AutoGenerateDeleteButton");
dv.AutoGenerateEditButton = true;
Assert.AreEqual (true, dv.AutoGenerateEditButton, "AutoGenerateEditButton");
dv.AutoGenerateInsertButton = true;
Assert.AreEqual (true, dv.AutoGenerateInsertButton, "AutoGenerateInsertButton");
dv.AutoGenerateRows = false;
Assert.AreEqual (false, dv.AutoGenerateRows, "AutoGenerateRows");
dv.BackImageUrl = "image.jpg";
Assert.AreEqual ("image.jpg", dv.BackImageUrl, "BackImageUrl");
dv.Caption = "Caption Test";
Assert.AreEqual ("Caption Test", dv.Caption, "Caption");
dv.CaptionAlign = TableCaptionAlign.Right;
Assert.AreEqual (TableCaptionAlign.Right, dv.CaptionAlign, "CaptionAlign");
dv.CellPadding = 2;
Assert.AreEqual (2, dv.CellPadding, "CellPadding");
dv.CellSpacing = 5;
Assert.AreEqual (5, dv.CellSpacing, "CellSpacing");
dv.CommandRowStyle.BackColor = Color.Purple;
Assert.AreEqual (Color.Purple, dv.CommandRowStyle.BackColor, "CommandRowStyle.BackColor");
dv.ChangeMode (DetailsViewMode.Insert);
Assert.AreEqual (DetailsViewMode.Insert, dv.CurrentMode, "CurrentModeInsert");
dv.ChangeMode (DetailsViewMode.Edit );
Assert.AreEqual (DetailsViewMode.Edit, dv.CurrentMode, "CurrentModeEdit");
Assert.AreEqual ("Item1", dv.DataItem, "DataItem");
Assert.AreEqual (6, dv.DataItemCount, "DataItemCount");
Assert.AreEqual (0, dv.DataItemIndex, "DataItemIndex");
string[] names ={ "test1", "test2", "test3" };
dv.DataKeyNames = names;
Assert.AreEqual (names, dv.DataKeyNames, "DataKeyNames");
dv.DefaultMode = DetailsViewMode.Edit;
Assert.AreEqual (DetailsViewMode.Edit, dv.DefaultMode, "DefaultModeEdit");
dv.DefaultMode = DetailsViewMode.Insert;
Assert.AreEqual (DetailsViewMode.Insert, dv.DefaultMode, "DefaultModeInsert");
dv.DefaultMode = DetailsViewMode.ReadOnly;
Assert.AreEqual (DetailsViewMode.ReadOnly, dv.DefaultMode, "DefaultModeReadOnly");
dv.EditRowStyle.ForeColor = Color.Pink;
Assert.AreEqual (Color.Pink, dv.EditRowStyle.ForeColor, "EditRowStyle");
dv.EmptyDataRowStyle.HorizontalAlign = HorizontalAlign.Center;
Assert.AreEqual (HorizontalAlign.Center, dv.EmptyDataRowStyle.HorizontalAlign, "HorizontalAlignCenter");
dv.EmptyDataTemplate = new DTemplate ();
Assert.AreEqual (typeof (DTemplate), dv.EmptyDataTemplate.GetType() , "EmptyDataTemplate");
dv.EmptyDataText = "No Data";
Assert.AreEqual ("No Data", dv.EmptyDataText, "EmptyDataText");
dv.EnablePagingCallbacks = true;
Assert.AreEqual (true, dv.EnablePagingCallbacks, "EnablePagingCallbacks");
dv.FieldHeaderStyle.CssClass = "style.css";
Assert.AreEqual ("style.css", dv.FieldHeaderStyle.CssClass, "FieldHeaderStyle");
DataControlFieldCollection coll=new DataControlFieldCollection ();
dv.FooterStyle.HorizontalAlign = HorizontalAlign.Right ;
Assert.AreEqual (HorizontalAlign.Right, dv.FooterStyle.HorizontalAlign , "FooterStyle");
dv.FooterTemplate = new DTemplate ();
Assert.AreEqual (typeof(DTemplate ),dv.FooterTemplate.GetType() ,"FooterTemplate");
dv.FooterText = "Footer Text";
Assert.AreEqual ("Footer Text", dv.FooterText, "FooterText");
dv.GridLines = GridLines.Horizontal;
Assert.AreEqual (GridLines.Horizontal, dv.GridLines, "GridLinesHorizontal ");
dv.GridLines = GridLines.None;
Assert.AreEqual (GridLines.None , dv.GridLines, "GridLinesNone ");
dv.GridLines = GridLines.Vertical;
Assert.AreEqual (GridLines.Vertical, dv.GridLines, "GridLinesVertical ");
dv.GridLines = GridLines.Both;
Assert.AreEqual (GridLines.Both, dv.GridLines, "GridLinesBoth ");
dv.HeaderStyle.BorderColor = Color.PapayaWhip;
Assert.AreEqual (Color.PapayaWhip, dv.HeaderStyle.BorderColor, "HeaderStyle");
dv.HeaderTemplate = new DTemplate ();
Assert.AreEqual (typeof (DTemplate), dv.HeaderTemplate.GetType (), "HeaderTemplate");
dv.HeaderText = "Header Text";
Assert.AreEqual ("Header Text", dv.HeaderText, "HeaderText");
dv.HorizontalAlign = HorizontalAlign.Center;
Assert.AreEqual (HorizontalAlign.Center, dv.HorizontalAlign, "HorizontalAlignCenter");
dv.HorizontalAlign = HorizontalAlign.Justify;
Assert.AreEqual (HorizontalAlign.Justify , dv.HorizontalAlign, "HorizontalAlignJustify");
dv.HorizontalAlign = HorizontalAlign.Left ;
Assert.AreEqual (HorizontalAlign.Left , dv.HorizontalAlign, "HorizontalAlignLeft");
dv.HorizontalAlign = HorizontalAlign.NotSet ;
Assert.AreEqual (HorizontalAlign.NotSet , dv.HorizontalAlign, "HorizontalAlignNotSet");
dv.HorizontalAlign = HorizontalAlign.Right ;
Assert.AreEqual (HorizontalAlign.Right , dv.HorizontalAlign, "HorizontalAlignRight");
dv.InsertRowStyle.BackColor = Color.PeachPuff;
Assert.AreEqual (Color.PeachPuff, dv.InsertRowStyle.BackColor, "InsertRowStyle");
Assert.AreEqual (6, dv.PageCount, "PageCount");
Assert.AreEqual (0, dv.PageIndex, "PageIndex");
dv.PagerSettings.LastPageImageUrl = "image.jpg";
Assert.AreEqual ("image.jpg", dv.PagerSettings.LastPageImageUrl, "PagerSettings");
dv.PagerStyle.CssClass = "style.css";
Assert.AreEqual ("style.css", dv.PagerStyle.CssClass, "PagerStyle");
dv.PagerTemplate = new DTemplate ();
Assert.AreEqual (typeof (DTemplate), dv.PagerTemplate.GetType (), "PagerTemplate");
Assert.AreEqual (1, dv.Rows.Count, "Rows");
dv.RowStyle.BackColor = Color.Plum ;
//.........这里部分代码省略.........
示例5: DetailsView_BubbleEvents
public void DetailsView_BubbleEvents ()
{
ResetEvents ();
DetailsViewCommandEventArgs com;
PokerDetailsView dv = new PokerDetailsView ();
dv.DataSource = TableObject.CreateDataTable ();
Page page = new Page ();
Button bt = new Button ();
dv.AllowPaging = true;
dv.DataSource = myds;
page.Controls.Add (dv);
dv.DataBind ();
dv.ItemCommand += new DetailsViewCommandEventHandler (dv_ItemCommand );
dv.ItemDeleted += new DetailsViewDeletedEventHandler (dv_ItemDeleted );
//Delete
dv.ItemDeleting += new DetailsViewDeleteEventHandler (dv_ItemDeleting );
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Delete", null));
Assert.AreEqual (false, itemCommand, "BeforeDeleteCommandBubbleEvent");
Assert.AreEqual (false, itemDeleting, "BeforeDeleteBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Delete");
Assert.AreEqual (true, itemDeleting, "AfterDeleteBubbleEvent");
Assert.AreEqual (true, itemCommand, "AfterDeleteCommandBubbleEvent");
//Insert
itemCommand = false;
dv.ItemInserting += new DetailsViewInsertEventHandler (dv_ItemInserting);
dv.ChangeMode (DetailsViewMode.Insert);
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Insert", null));
Assert.AreEqual (false, itemCommand, "BeforeInsertCommandBubbleEvent");
Assert.AreEqual (false, itemInserting, "BeforeInsertBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Insert");
Assert.AreEqual (true, itemCommand, "AfterInsertCommandBubbleEvent");
Assert.AreEqual (true, itemInserting, "AfterInsertBubbleEvent");
//Update
itemCommand = false;
dv.ItemUpdating += new DetailsViewUpdateEventHandler (dv_ItemUpdating);
dv.ChangeMode (DetailsViewMode.Edit);
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Update", null));
Assert.AreEqual (false, itemUpdating, "BeforeUpdateEvent");
Assert.AreEqual (false, itemCommand, "BeforeUpdateCommandEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Update");
Assert.AreEqual (true, itemCommand, "AfterUpdateCommandBubbleEvent");
Assert.AreEqual (true, itemUpdating, "AfterUpdateBubbleEvent");
//Cancel
itemCommand = false;
dv.ModeChanging += new DetailsViewModeEventHandler (dv_ModeChanging);
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Cancel", null));
Assert.AreEqual (false, itemCommand, "BeforeCancelCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeCancelBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Cancel");
Assert.AreEqual (true, itemCommand, "AfterCancelCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterCancelBubbleEvent");
//Edit
itemCommand = false;
modeChanging = false;
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Edit", null));
Assert.AreEqual (false, itemCommand, "BeforeEditCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeEditBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Edit");
Assert.AreEqual (true, itemCommand, "AfterEditCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterEditBubbleEvent");
//New
itemCommand = false;
modeChanging = false;
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("New", null));
Assert.AreEqual (false, itemCommand, "BeforeNewCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeNewBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - New");
Assert.AreEqual (true, itemCommand, "AfterNewCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterNewBubbleEvent");
//Page Index default
itemCommand = false;
dv.PageIndexChanging += new DetailsViewPageEventHandler (dv_PageIndexChanging );
com = new DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Page", null));
Assert.AreEqual (false, itemCommand, "BeforePageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging, "BeforePageBubbleEvent");
Assert.IsTrue (dv.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 DetailsViewCommandEventArgs (bt, new CommandEventArgs ("Page", "Next"));
Assert.AreEqual (false, itemCommand, "BeforeNextPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging, "BeforeNextPageBubbleEvent");
Assert.IsTrue (dv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Next Page");
Assert.AreEqual (true, itemCommand, "AfterNextPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging, "AfterNextPageBubbleEvent");
Assert.AreEqual (1, newPageIndex, "NextPageIndex");
//Prev Page
itemCommand = false;
pageIndexChanging = false;
//.........这里部分代码省略.........
示例6: DetailsView_PageIndex3
public void DetailsView_PageIndex3 ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.AutoGenerateRows = false;
dv.Fields.Add (new TemplateField ());
dv.Page = new Page ();
dv.PageIndex = 10;
dv.DefaultMode = DetailsViewMode.Insert;
dv.SetRequiresDataBinding (true);
Assert.AreEqual (0, dv.PageCount, "#0");
Assert.AreEqual (-1, dv.PageIndex, "#1");
dv.DataSource = myds;
dv.DoEnsureDataBound ();
Assert.AreEqual (0, dv.PageCount, "#2");
Assert.AreEqual (-1, dv.PageIndex, "#3");
dv.ChangeMode (DetailsViewMode.ReadOnly);
Assert.AreEqual (0, dv.PageCount, "#4");
Assert.AreEqual (10, dv.PageIndex, "#5");
}