This is my method. I've been using it for all my customized page data
in
datagrid, it works well.
(1)Declare a static class variable called CurrentPage to store current
page
number
eg. private static long CurrentPage;
(2)On the NextPage click function and PreviousPage click function,
assign
the data "Test" to ViewState
eg. CurrentPage =3D your_current_page_number; // eg. 1
ViewState["CurrentPage"] =3D CurrentPage;
ViewState[CurrentPage.ToString() + "-MyText"] =3D txtMyText.Text;
//ie. "Test"
CurrentPage++; // for next page click
//CurrentPage--; // for previous page click
(3)On the Page_Load function, restore data from ViewState
eg. CurrentPage =3D your_current_page_number
txtMyText.Text =3D (string) ViewState[CurrentPage.ToString() +
"-MyText"]
Josephine
-----Original Message-----
From: mpiehota@r... [mailto:mpiehota@r...]
Sent: 2002=C4=EA6=D4=C22=C8=D5 10:10
To: ASPX_Professional
Subject: [aspx_professional] Maintain Viewstate for Datagrid with
Paging
Is it possible to maintain viewstate on a datagrid when navigating
between pages? For example, I have a textbox in a row in the datagrid
on
Page 1. I enter "Test". I then navigate to Page 2 (using the default
datagrid page navigation). When I navigate back to Page 1, I want to
have the textbox reappear with the word "Test" in it.
Thanks in advance for any thoughts on the matter.