本文整理匯總了C#中MonoTests.System.Web.UI.WebControls.TestDataList.SaveState方法的典型用法代碼示例。如果您正苦於以下問題:C# TestDataList.SaveState方法的具體用法?C# TestDataList.SaveState怎麽用?C# TestDataList.SaveState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MonoTests.System.Web.UI.WebControls.TestDataList
的用法示例。
在下文中一共展示了TestDataList.SaveState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveViewState
public void SaveViewState ()
{
TestDataList dl = new TestDataList ();
dl.TrackState ();
object[] vs = (object[]) dl.SaveState ();
#if NET_2_0
Assert.AreEqual (9, vs.Length, "Size");
#else
Assert.AreEqual (8, vs.Length, "Size");
#endif
// By default the viewstate is all null
int i = 0;
for (; i < vs.Length; i++)
Assert.IsNull (vs [i], "Empty-" + i);
i = 0;
#if NET_2_0
i++;
#else
dl.GridLines = GridLines.Vertical;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "GridLines");
#endif
dl.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "ItemStyle");
dl.SelectedItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "SelectedItemStyle");
dl.AlternatingItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "AlternatingItemStyle");
dl.EditItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "EditItemStyle");
dl.SeparatorStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "SeparatorStyle");
dl.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "HeaderStyle");
dl.FooterStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "FooterStyle");
#if NET_2_0
// GridLines was moved last
dl.GridLines = GridLines.Vertical;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "GridLines");
#endif
}