Gridview and bound field hidden

C

Chris Botha

I have a gridview with bound columns as well as auto select turned on and
everything works well.
The 1st column is the record ID and as seeing this does not help the user, I
want to hide it, so I set the visible property of the column to false.
Now on post-back when selecting a record, the cell is still there, however
it is empty - it does not contain the ID any more, it contains an empty
string.
My first opinion is that this is not so extremely useful then. My question
would be how do I hide a column but still have the value on post-back?

Thanks.
 
M

Muhammad Naveed Yaseen

Preferred choice would be to use DataKeyNames property of GridView and
then access it through GridView's key collection (DataKeys).

If that is not possible then a TemplateField may be used with a
Literal or Label with visible set false.
 

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,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top