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

Getting cell value of a hidden column - client side

1 Answer 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Augusto
Top achievements
Rank 1
Augusto asked on 20 Nov 2011, 11:14 AM
Hello.

For you information, the javascript code I have used to get the value of a hidden value is:

function GetSelectedRowCellValue(sender, args) {
    var grid = $find("RadGridMain");
    var selected = grid.get_masterTableView().get_selectedItems();
    if (sel.length > 0) {
        var row = grid.get_masterTableView().get_selectedItems()[0];
        var cellValue = grid.get_masterTableView().getCellByColumnUniqueName(row, "TheColumnName").innerText;
        ...
    }
    ...
}

The ASP.NET code is:

<telerik:GridBoundColumn DataField="TheColumnName" UniqueName="TheColumnName" DataType="System.Int32" Visible="true" Display="false" />

The Visible and Display settings are important.

I hope this can help other developers.

Regards
Augusto

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 21 Nov 2011, 04:37 AM
Hello Augusto,

Try setting the ClientDataKeyName as ColumnName and access the value as shown below.
JS:
function clicked(r)
{
   var row = $find('<%= RadGrid1.ClientID %>').get_masterTableView().get_dataItems();
   alert(row.getDataKeyValue("ID"));//DataKeyName
}

-Shinu.
Tags
Grid
Asked by
Augusto
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or