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

Read datakey values in javascript

2 Answers 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abhishek
Top achievements
Rank 1
Abhishek asked on 04 Oct 2011, 11:24 AM
Hi,
i  am using Telerik version released in July 2010. I want to bind a dropdown list on page from selected item empName in grid where empId is bound in griddatakey.
I am not able to use property "RadGrid.ClientSettings.EnableClientKeyValues" which is mentioned in post http://www.telerik.com/community/forums/aspnet/grid/how-to-get-datakeynames-amp-datakeyvalues-on-client-side.aspx to read empId bound in griddatakey.

Please give resolution?

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Oct 2011, 11:29 AM
Hello,

please set below property for getting datakey client side .
<MasterTableView ClientDataKeyNames="ID"

let me know if any concern.

Thanks,
Jayesh Goyani
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Oct 2011, 11:33 AM
Hello,

<MasterTableView Name="Master" DataKeyNames="EmployeeID" ClientDataKeyNames="EmployeeID"
<script type="text/javascript">
function GetFirstDataItemKeyValues()
{
    var gvID = $find('<%=RadGrid1.ClientID %>');
    var masterTableView = gvID.get_masterTableView();
    var firstDataItem = masterTableView.get_dataItems()[0];
    alert(firstDataItem.getDataKeyValue("EmployeeID"));                 
}
</script>


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Abhishek
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or