GridView controls and hidden columns

P

PeterKellner

The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.

The workaround is to add to the gridview attribute
datakeynames=[myhiddendatavalue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate and
performance you should keep in mind also.

Peter Kellner
http://peterkellner.net
 
M

Mark Rae

The problem is that in asp.net 2.0, Microsoft has decided not to store
hidden columns in viewstate for security reasons. That is, say you put
payroll data in a table and made the column hidden for non-hr people. Us
developer types could look at viewstate and get it.

Seems reasonable.
The workaround is to add to the gridview attribute
datakeynames=[myhiddendatavalue,...] and this will force the hidden column
back into viewstate. There are also issues around encrypting viewstate
and performance you should keep in mind also.

Understood - thanks for the response.
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top