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

Dynamic ClientDataKeyNames?

3 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AereoN
Top achievements
Rank 1
AereoN asked on 29 Jan 2010, 02:53 AM
May I know how do I manipulate the ClientDataKeyNames from code behind?
I tried to search the documentation but can't seem to find any issue about this.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 01 Feb 2010, 06:45 AM
Hello AereoN,

ClientDataKeyNames is property of GridTableView object. Here is related documentations to this property:
http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.gridtableview-clientdatakeynames.html
http://www.telerik.com/help/aspnet-ajax/grid_get_clientdatakeynames.html

Kind regards,
Rusev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
AereoN
Top achievements
Rank 1
answered on 02 Feb 2010, 09:31 AM
Hi Rusev,

My default grid only contains 3 column hence I declared 3 clientdatakeynames in the design mode.
However this grid can be used to display another additional data which requires the 4th column hence I need to add the additional clientdatakeynames into the grid so I can extract it out via javascript.
Do you know how can I achieve this?

Thanks.
0
Rosen
Telerik team
answered on 04 Feb 2010, 09:07 AM
Hi AereoN,

As pointed in the documentation my colleague have referred to, the ClientDataKeyNames is an string array which holds the names of the fields which values should be serialized to the client. As with any other property, you may change it value dynamically during the execution of the control by assigning a new array instance with the appropriate values. However you should have in mind that a rebind may be needed if the new name is added after the grid is populated. Also the ClientDataKeyNames values are not stored into the ViewState thus you should re-create the collection on every postback.

Sincerely yours,
Rosen
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Grid
Asked by
AereoN
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
AereoN
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or