gridView Viewstate

C

Chuck P

I was trying to understand why the GridView displays some less than
desireable features when ViewState is disabled.

If you disable viewstate, you can delete or update the wrong records.

http://scottonwriting.net/sowblog/posts/10054.aspx

I don't understand why when a postback occurs that the GridView re-reads
from the DataSource when ViewState is disabled. Why doesn't it just use the
values in the DataKeys collection that was returned with the post in the
controlState?
I am assuming the Keys are in the control state.

I am assuming it is in the control state because, the other day I had to add
a non-displayable column (RowVersion:timestamp) to the DataKeys collection
because I was using it in my Update/Delete parameters. Why do I need to
include RowVersion in the DataKeys, if the DataSource gets requeried anyway?

thanks,
 
W

Walter Wang [MSFT]

Hi Chuck,

It's only the name of key fields are stored in control state, the values
for the key fields are stored in view state. When view state is disabled,
only the key fields name and the posted fields are posted back to server.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,219
Latest member
Geraldine7

Latest Threads

Top