SaveState() public method

public SaveState ( ) : object
return object
Ejemplo n.º 1
0
		public void GridView_ViewState ()
		{
			PokerGridView gv = new PokerGridView ();
			PokerGridView copy = new PokerGridView ();
			gv.AllowPaging = true;
			gv.AllowSorting = true;
			gv.BackColor = Color.Red;
			object state = gv.SaveState ();
			copy.LoadState (state);
			Assert.AreEqual (true, copy.AllowPaging, "ViewStateAllowPaging");
			Assert.AreEqual (true, copy.AllowSorting, "ViewStateAllowSorting");
			Assert.AreEqual (Color.Red, copy.BackColor, "ViewStateBackColor");
		}
Ejemplo n.º 2
0
		public void GridView_PageCount ()
		{
			Page p = new Page ();

			PokerGridView gv = new PokerGridView ();
			gv.PageSize = 3;
			gv.AllowPaging = true;
			p.Controls.Add (gv);

			ObjectDataSource data = new ObjectDataSource ();
			data.ID = "ObjectDataSource1";
			data.TypeName = typeof (DataSourceObject).AssemblyQualifiedName;
			data.SelectMethod = "GetList";
			p.Controls.Add (data);

			gv.DataSourceID = "ObjectDataSource1";
			gv.SetRequiresDataBinding (true);

			Assert.AreEqual (0, gv.PageCount, "PageCount before binding");

			gv.DataBind ();

			Assert.AreEqual (2, gv.PageCount, "PageCount after binding");

			PokerGridView copy = new PokerGridView ();
			copy.LoadState (gv.SaveState ());

			Assert.AreEqual (2, copy.PageCount, "PageCount from ViewState");
		}