For security reasons, we no longer databind fields that aren't visible, as you've noticed. This was because often users thought making a field invisible prevented its contents from getting to the client, when in fact the values were present in ViewState.
If you need a value of a particular field but don't want to display it, add it to your DataKeyNames property and you can access the value through the DataKeys property. This has the added benefit of saving off the real value of the field rather than the
ToString() representation of the value.
Polita Paulus
This posting is provided "AS IS" with no warranties, and confers no rights.
phuff
Contributor
2700 Points
547 Posts
AspNetTeam
Re: gridview column w/visible=false no longer contains cell data in beta 2
Apr 20, 2005 09:20 PM|LINK
For security reasons, we no longer databind fields that aren't visible, as you've noticed. This was because often users thought making a field invisible prevented its contents from getting to the client, when in fact the values were present in ViewState.
If you need a value of a particular field but don't want to display it, add it to your DataKeyNames property and you can access the value through the DataKeys property. This has the added benefit of saving off the real value of the field rather than the ToString() representation of the value.
This posting is provided "AS IS" with no warranties, and confers no rights.