Last post Apr 29, 2008 01:55 AM by crbherde
Apr 28, 2008 07:14 AM|crbherde|LINK
I am writing my first custom control which is a custom grid. I have extended the GridView class. I am adding some columns (4 columns) which are visible to users. I also have some data (IDs for rows) which I don't want to display to users but want to hold
along with each row. For this column, I am creating a TemplateField and adding a invisible text box to it to hold IDs. When the grid is loaded first time, it has 5 columns (4 visible + 1 invisible). But when I click on "Delete" or "Edit" link on grid, I
get only the first 4 columns and the ID which I had added earlier is lost. I am adding all the columns in only one place. Can somebody please suggest any solution.
Apr 28, 2008 01:56 PM|dinoboy|LINK
Why you don't use GridView's
DataKeys properties for storing ids? They should be used exactly in such cases.
You can even define multiple keys. You can access keys in the same way as accessing rows, that is through GridView.DataKeys[rowIndex] accessor.
Apr 29, 2008 01:55 AM|crbherde|LINK
Great!! Thank you very much. I just realised that I wasted my weekend creating problems for myself and then sorting them.