Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have one keycolumns in data grid. for example EmpID.

currently i am displaying this columns. but, i don't want to make visible in the grid this values. just i want to hide the columns.

If i hide this columns, the keyvalue will not come for update and delete the records.

Just i want to hide the keycolumns, but, the values should read.

What i want to do..?

Regards,
Ganesh.S
Posted

Basically, you need to trap the RowCreated event and set the cell's Visible property to false for the cells that you want to hide. Please see this short blog[^]. It references this tutorial[^] which talks about why the solution works.
 
Share this answer
 
Use DataKeyNames[^]. If you hide a column, you will not get that values in code.
So use DataKeyNames. This is the good way of doing.

Check the following links. This will help you how to get the values.

http://www.mindfiresolutions.com/DataKeys-and-DataKeyNames-Property-of-Listview-or-Gridview-479.php[^]

http://www.codedigest.com/Articles/ASPNET/212_How_to_edit_and_Delete_records_in_a_gridview_using_datakeys.aspx[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900