How do I place a hidden ID column into a grid

2 posts, 0 answers
  1. Tim
    Tim avatar
    57 posts
    Member since:
    Apr 2011

    Posted 24 May 2011 Link to this post


    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.

  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 24 May 2011 Link to this post

    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();

    Hope this helps!
Back to Top