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

Change the ClientDataKeyNames values from the client?

4 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeremy Yoder
Top achievements
Rank 1
Jeremy Yoder asked on 25 Aug 2010, 11:07 PM

Through the eventArgs param in my OnRowSelected function, I'm using eventArgs.getDataKeyValue(columnName) to get the column's value. (After setting that column name in the ClientDataKeyNames property.)

Is it possible to change that column's value in the underlying datatable in the client-side code? Or do I have to call server-side code to change it? Thanks.

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 26 Aug 2010, 09:03 AM
Hello Jeremy,

RadGrid serialize ClientDataKeyNames on client in following array:
$find("RadGrid.ClientID").get_masterTableView()._data.clientDataKeyNames

However you should use this array to change data keys on client on your own risk as  this might not work in all cases. Best approach will be to postback and change the keys on server.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jeremy Yoder
Top achievements
Rank 1
answered on 26 Aug 2010, 02:00 PM

Sorry, but I think I was underclear. You're describing how I can change the actual names in ClientDataKeyNames, which I can understand from the wording in my post. But what I meant was, can I change the underlying data within that column.

For example, say I have ClientDataKeyNames="EmployeeID, EmployeeActive" with multiple rows. When I retrieve the value in my OneRowSelected function (via getDataKeyValue for EmployeeActive) I see it has a value of "True". I then want to change the value on the client side to "False" within the datatable that the grid is displaying.

Is that possible? (For what it's worth, the column has a width of 0 so it's not displayed. Therefore, I don't need the grid display to update -- only the data behind the scenes.)
0
Nikolay Rusev
Telerik team
answered on 26 Aug 2010, 03:14 PM
Hello Jeremy,

You cannot do this. Nevertheless these values are not send back to server. ClientDataKeyNames are intended to use on client-side only once they are populated/served from server. The values for the items will be also repopulated automatically if client-side binding is used, but still those values will never be send on server.

All the best,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jeremy Yoder
Top achievements
Rank 1
answered on 26 Aug 2010, 04:38 PM

Currently, I am sending the new value to server-side via an Ajax call, and changing the data in the dataset then. However, it sounds like I can't touch the dataset on the client-side through the grid, so I'll just keep using the Ajax call. Thanks.
Tags
Grid
Asked by
Jeremy Yoder
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Jeremy Yoder
Top achievements
Rank 1
Share this question
or