Viewstate enabled and set, but not all data is being stored in thepage

  • Thread starter Thread starter Keith Murray
  • Start date Start date
K

Keith Murray

I have a custom web control, similar to a datagrid. The grid can have a
button that the user clicks to select the row. I use a custom button
with a data field that is stored in the Viewstate. So far, this is
working fine.

If I add another button to the row in exactly the same manner, the
Viewstate for that button is not saved. I turned on the Trace for the
page and it shows first button containing 56 bytes of Viewstate, but the
second button shows zero.

I debugged through the creation of the grid. All components have
EnabledViewState = true. I checked the Viewstate bag before the page is
posted and all buttons contained the "ButtonData" object. It appears
that when the page is rendered, the viewstate object is not picking up
the second button.

Is there some tool that can be used to pull the Viewstate string apart?

Thanks,
Keith
 
I have a custom web control, similar to a datagrid. The grid can
have a button that the user clicks to select the row. I use a
custom button with a data field that is stored in the Viewstate.
So far, this is working fine.

If I add another button to the row in exactly the same manner,
the Viewstate for that button is not saved. I turned on the
Trace for the page and it shows first button containing 56 bytes
of Viewstate, but the second button shows zero.

I debugged through the creation of the grid. All components have
EnabledViewState = true. I checked the Viewstate bag before the
page is posted and all buttons contained the "ButtonData"
object. It appears that when the page is rendered, the viewstate
object is not picking up the second button.

Is there some tool that can be used to pull the Viewstate string
apart?

Keith,

Here's an MSDN article w/ code that can be used to parse a view state string:

Understanding ASP.NET View State
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/viewstate.asp
 
Back
Top