New to Telerik UI for ASP.NET AJAX? Download free 30-day trial


  • Gets a single string parameter representing a DataField bound to the RadGrid and added to the ClientDataKeyNames collection of the MasterTableView/GridTableView.

  • Returns a string of the dataKeyValue, associated with the GridDataItem.

The DataField name passed to the getDataKeyValue method has to be part of the ClientDataKeyNames array of the MasterTableView/GridTableView.


Call get_dataKeyValue() on row double click:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource">
        <ClientEvents OnRowDblClick="onRowDblClick" />
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" ClientDataKeyNames="ID, LastName">
            <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"
                FilterControlAltText="Filter ID column" HeaderText="ID"
                ReadOnly="True" SortExpression="ID" UniqueName="ID">
            <telerik:GridBoundColumn DataField="FirstName"
                FilterControlAltText="Filter FirstName column" HeaderText="First Name"
                SortExpression="FirstName" UniqueName="FirstName">
            <telerik:GridBoundColumn DataField="LastName"
                FilterControlAltText="Filter LastName column" HeaderText="Last Name"
                SortExpression="LastName" UniqueName="LastName">
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    var grid = sender as RadGrid;
    grid.DataSource = Enumerable.Range(1, 10).Select(x => new { ID = x, FirstName = "First Name " + x, LastName = "Last Name " + x });
Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
    Dim grid = TryCast(sender, RadGrid)
    grid.DataSource = Enumerable.Range(1, 10).Select(Function(x) New With {Key .ID = x, Key .FirstName = "First Name " & x, Key .LastName = "Last Name " & x
End Sub
function onRowDblClick(sender, args) {
    var dataItem = args.get_item();
    var id = dataItem.getDataKeyValue("ID");
    var lastName = dataItem.getDataKeyValue("LastName");
    alert("Clicked item key values:" + "\n" +
        "ID: " + id + "\n" +
        "Last Name: " + lastName);

You can see one more practical example of the method in its dedicated section in the Accessing Grid Cells, Cell Values and Raw DataKey Values Client-Side article.

In this article