本文整理汇总了C#中PokerDetailsView.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# PokerDetailsView.DataBind方法的具体用法?C# PokerDetailsView.DataBind怎么用?C# PokerDetailsView.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PokerDetailsView
的用法示例。
在下文中一共展示了PokerDetailsView.DataBind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetailsView_RequiresDataBinding_LoadComplete
public static void DetailsView_RequiresDataBinding_LoadComplete (Page p) {
PokerDetailsView view = new PokerDetailsView ();
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");
}
示例2: 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 ;
//.........这里部分代码省略.........
示例3: DetailsView_DataKey
public void DetailsView_DataKey () {
Page p = new Page ();
PokerDetailsView fv = new PokerDetailsView ();
p.Controls.Add (fv);
ObjectDataSource data = new ObjectDataSource ();
data.TypeName = typeof (TableObject).AssemblyQualifiedName;
data.SelectMethod = "GetMyData";
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");
PokerDetailsView copy = new PokerDetailsView ();
object state = fv.DoSaveControlState ();
copy.DoLoadControlState (state);
DataKey key4 = copy.DataKey;
Assert.AreEqual (1001, key4.Value, "DataKey.Value from ControlState");
Assert.AreEqual (2, key4.Values.Count, "DataKey.Values count from ControlState");
Assert.AreEqual (1001, key4.Values [0], "DataKey.Values[0] from ControlState");
Assert.AreEqual ("Mahesh", key4.Values [1], "DataKey.Values[1] from ControlState");
}
示例4: DetailsView_CreateDataSourceSelectArguments
public void DetailsView_CreateDataSourceSelectArguments () {
DataSourceView view;
Page p = new Page ();
PokerDetailsView dv = new PokerDetailsView ();
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");
}
示例5: DetailsView_DeleteItem
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 ();
}
示例6: DetailsView_PageIndex4
public void DetailsView_PageIndex4 ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.AllowPaging = true;
dv.AutoGenerateRows = false;
dv.Fields.Add (new TemplateField ());
dv.Page = new Page ();
dv.PageIndex = 10;
dv.DataSource = myds;
dv.DataBind ();
Assert.AreEqual (6, dv.PageCount, "#0");
Assert.AreEqual (5, dv.PageIndex, "#1");
}
示例7: DetailsView_InitializePager
public void DetailsView_InitializePager ()
{
PokerDetailsView dv = new PokerDetailsView ();
Page page = new Page ();
dv.AllowPaging = true;
dv.DataSource = myds;
page.Controls.Add (dv);
Assert.AreEqual (0, dv.PageCount, "BeforeInitializePagerPageCount");
Assert.AreEqual (false, dv.isInitializePager, "BeforeInitializePager");
dv.DataBind ();
Assert.AreEqual (true, dv.isInitializePager, "AfterInitializePager");
Assert.AreEqual (6, dv.PageCount, "AfterInitializePagerPageCount");
}
示例8: FormView_DataBind
public void FormView_DataBind ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.AllowPaging = true;
dv.DataSource = myds;
Assert.AreEqual (0, dv.PageCount, "BeforeDataBind1");
Assert.AreEqual (null, dv.DataItem, "BeforeDataBind2");
dv.DataBind ();
Assert.AreEqual (6, dv.PageCount, "AfterDataBind1");
Assert.AreEqual (6, dv.DataItemCount, "AfterDataBind2");
Assert.AreEqual ("Item1", dv.DataItem, "AfterDataBind3");
}
示例9: DetailsView_CreateFieldSet_useDataSource
public void DetailsView_CreateFieldSet_useDataSource ()
{
DataTable ds = TableObject.CreateDataTable ();
PokerDetailsView dv2 = new PokerDetailsView ();
dv2.DataSource = ds;
dv2.DataBind ();
ICollection fieldSet2 = dv2.DoCreateFieldSet ("FieldTest", false);
Assert.AreEqual (3, fieldSet2.Count, "FiledSetCount");
Assert.AreEqual ("ID", ((ArrayList) fieldSet2)[0].ToString (), "FieldValue1");
Assert.AreEqual (typeof (Int32), ((AutoGeneratedField) ((ArrayList) fieldSet2)[0]).DataType, "FieldType1");
Assert.AreEqual ("FName", ((ArrayList) fieldSet2)[1].ToString (), "FieldValue2");
Assert.AreEqual (typeof (String), ((AutoGeneratedField) ((ArrayList) fieldSet2)[1]).DataType, "FieldType2");
Assert.AreEqual ("LName", ((ArrayList) fieldSet2)[2].ToString (), "FieldValue3");
Assert.AreEqual (typeof (String), ((AutoGeneratedField) ((ArrayList) fieldSet2)[2]).DataType, "FieldType3");
}
示例10: DetailsView_GetCallBackResult
public void DetailsView_GetCallBackResult ()
{
PokerDetailsView dv = new PokerDetailsView ();
Page p = new Page ();
p.EnableEventValidation = false;
p.Controls.Add (dv);
DataTable ds = TableObject.CreateDataTable ();
dv.AllowPaging = true;
dv.EnablePagingCallbacks = true;
dv.DataSource = ds;
dv.DataBind ();
dv.DoRaiseCallbackEvent ("1||0|");
string cbres = dv.DoGetCallbackResult ();
Assert.IsNotNull (cbres);
if (cbres.IndexOf ("1002") == -1)
Assert.Fail ("Wrong item rendered fail");
}
示例11: DetailsView_CreateFieldSet_dont_useDataSource
public void DetailsView_CreateFieldSet_dont_useDataSource ()
{
DataTable ds = TableObject.CreateDataTable ();
PokerDetailsView dv1 = new PokerDetailsView ();
dv1.DataSource = ds;
dv1.DataBind ();
ICollection fieldSet1 = dv1.DoCreateFieldSet ("FieldTest", true);
Assert.AreEqual (1, fieldSet1.Count, "FiledSetCount");
AutoGeneratedField agf = (AutoGeneratedField) ((ArrayList) fieldSet1)[0];
Assert.AreEqual ("Item", agf.HeaderText, "FieldSetCount");
}
示例12: DetailsView_ExtractRowValues
public void DetailsView_ExtractRowValues ()
{
PokerDetailsView dv = new PokerDetailsView ();
DataTable ds = TableObject.CreateDataTable ();
dv.DataSource = ds;
dv.DataBind ();
OrderedDictionary fieldsValues = new OrderedDictionary ();
dv.DoExtractRowValues (fieldsValues, true, true);
Assert.AreEqual (3, fieldsValues.Count, "ExtractRowValues1");
Assert.AreEqual (3, fieldsValues.Keys.Count, "ExtractRowValues2");
Assert.AreEqual (3, fieldsValues.Values.Count, "ExtractRowValues3");
Assert.AreEqual (true, fieldsValues.Contains ("ID"), "ExtractRowValues4");
IDictionaryEnumerator enumerator=fieldsValues.GetEnumerator ();
enumerator.MoveNext ();
Assert.AreEqual ("ID",enumerator.Key,"FieldValue1");
Assert.AreEqual ("1001", enumerator.Value , "FieldValue2");
enumerator.MoveNext ();
Assert.AreEqual ("FName", enumerator.Key, "FieldValue3");
Assert.AreEqual ("Mahesh", enumerator.Value, "FieldValue4");
enumerator.MoveNext ();
Assert.AreEqual ("LName", enumerator.Key, "FieldValue5");
Assert.AreEqual ("Chand", enumerator.Value, "FieldValue6");
fieldsValues = new OrderedDictionary ();
dv.DoExtractRowValues (fieldsValues, false, false);
Assert.AreEqual (0, fieldsValues.Count, "ExtractRowValues-NotReadOnly1");
fieldsValues = new OrderedDictionary ();
dv.DoExtractRowValues (fieldsValues, true, false);
Assert.AreEqual (3, fieldsValues.Count, "ExtractRowValues-NoPrimaryKeys1");
Assert.AreEqual (3, fieldsValues.Keys.Count, "ExtractRowValues-NoPrimaryKeys2");
fieldsValues = new OrderedDictionary ();
dv.DoExtractRowValues (fieldsValues, false, true);
Assert.AreEqual (0, fieldsValues.Count, "ExtractRowValues-NotReadOnly2");
Assert.AreEqual (0, fieldsValues.Keys.Count, "ExtractRowValues-NotReadOnly3");
}
示例13: DetailsView_PageIndex5
public void DetailsView_PageIndex5 ()
{
PokerDetailsView dv = new PokerDetailsView ();
dv.AutoGenerateRows = false;
dv.Fields.Add (new TemplateField ());
dv.Page = new Page ();
dv.PageIndex = 10;
dv.DataSource = new MyEnumSource(6);
dv.DataBind ();
Assert.AreEqual (5, dv.PageIndex, "#1");
}
示例14: DetailsView_EmptyContentRendering_Load
public static void DetailsView_EmptyContentRendering_Load(Page p)
{
LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
PokerDetailsView dv = new PokerDetailsView ();
dv.DataSource = new ArrayList ();
dv.HeaderText = "Header Text";
dv.FooterText = "Footer Text";
LinkButton lb = new LinkButton ();
lb.ID = "LinkButton1";
lb.Text = "Test";
p.Form.Controls.Add (lcb);
p.Form.Controls.Add (dv);
dv.DataBind ();
p.Form.Controls.Add (lb);
p.Form.Controls.Add (lce);
}
示例15: DetailsView_PrepareControlHierarchy
public void DetailsView_PrepareControlHierarchy ()
{
PokerDetailsView dv = new PokerDetailsView ();
//dv.Render ();
//Assert.AreEqual (0, dv.Controls.Count, "ControlHierarchy1");
//Assert.AreEqual (true, dv.controlHierarchy, "ControlHierarchy2");
dv.controlHierarchy = false;
dv.AllowPaging = true;
dv.DataSource = myds;
dv.DataBind ();
dv.Page = new Page ();
dv.Render ();
Assert.AreEqual (1, dv.Controls.Count, "ControlHierarchy3");
Assert.AreEqual (true, dv.controlHierarchy, "ControlHierarchy4");
Button bt = new Button ();
dv.Page.EnableEventValidation = false;
dv.Controls.Add (bt);
dv.controlHierarchy = false;
dv.Render ();
Assert.AreEqual (2, dv.Controls.Count, "ControlHierarchy3");
Assert.AreEqual (true, dv.controlHierarchy, "ControlHierarchy4");
}