This is a migrated thread and some comments may be shown as answers.

How do I place a hidden ID column into a grid

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 24 May 2011, 08:12 PM
Hi

I have created a grid with 3 columns and I am able to detect a row selection on the client side.

I want to query the row for an ID attribute, so that I can pass this ID to a server function.

I have tried using a hidden column but when I do that my call to

getCellByColumnUniqueName fails because the cell doesn't exist.

surely this is a fairly common requirement.

1 Answer, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 24 May 2011, 10:21 PM
Hi Tim,

I had the same issue when I first tried to have a hidden unique identifier column. The trick is understanding which methods of hiding a column happen in which steps of the page lifecycle. If the column is removed before the RadGrid is initialized, it literally won't exist on the page to reference (or make visible again). The way I handled this was to wire-up the OnGridCreated client-side method and hide the column at that point. The column is still there, only hidden - so you can reference it and make it visible if needed.

Here's an example.
function RadGrid1_OnGridCreated(sender, eventArgs) {
    var grid = sender;
    var MasterTable = grid.get_masterTableView();
 
    MasterTable.hideColumn(0);
}

Hope this helps!
-Gimmik
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Share this question
or