本文整理汇总了C#中PokerDetailsView.DoSaveControlState方法的典型用法代码示例。如果您正苦于以下问题:C# PokerDetailsView.DoSaveControlState方法的具体用法?C# PokerDetailsView.DoSaveControlState怎么用?C# PokerDetailsView.DoSaveControlState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PokerDetailsView
的用法示例。
在下文中一共展示了PokerDetailsView.DoSaveControlState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: DetailsView_ControlState
public void DetailsView_ControlState ()
{
PokerDetailsView dv = new PokerDetailsView ();
PokerDetailsView copy = new PokerDetailsView ();
string[] keys = new String[2];
keys[0] = "key1";
keys[1] = "key2";
dv.DataKeyNames = keys;
dv.BackImageUrl = "photo.jpg";
dv.DefaultMode = DetailsViewMode.Insert;
object state = dv.DoSaveControlState ();
copy.DoLoadControlState (state);
Assert.AreEqual ("key1", copy.DataKeyNames[0], "ControlStateDataKeyValue");
Assert.AreEqual ("key2", copy.DataKeyNames[1], "ControlStateDataKeyValue2");
Assert.AreEqual (DetailsViewMode.Insert, copy.DefaultMode, "ControlStateDefaultMode");
}