Formated Eval as ClientDataKeyNames

3 posts, 0 answers
  1. Sreenivas
    Sreenivas avatar
    5 posts
    Member since:
    Mar 2013

    Posted 02 Jun 2013 Link to this post


    i am using fulltextsqlquery to get result in share point search and binding results into a grid.

    The query returns "ID" and "StaffID".I would like to format those 2 values as mentioned below in gridtemplatecolumn.

    and i would like to use that formatted values which is say for ex - (1-33333) as my clientdatakeynames.

    Please suggest how could i achieve this?

     <telerik:GridTemplateColumn HeaderText="UniqueID" UniqueName="UniqueID" ItemStyle-CssClass="grid_column"
                                                        Visible="true" ItemStyle-Width="10%" >
                                                        <%# String.Format("{0}-{1}", Eval("ID"), Eval("StaffID"))%>    

    Thanks in advance.
  2. Angel Petrov
    Angel Petrov avatar
    1044 posts

    Posted 05 Jun 2013 Link to this post

    Hi Sreenivas,

    Since the ClientDataKeyNames should correspond to fields in the data source you can do the following.
    • Set the ID and StaffID as ClientDataKeyNames
    • Extract the wanted value using a JavaScript method which receives a data item as a parameter.


    <MasterTableView  ClientDataKeyNames="ID, StaffID" ...

    function GetClientDataKeyName(dataItem) {
                var clientDataKeyName = String.format("{0}-{1}", dataItem.getDataKeyValue("ID"), dataItem.getDataKeyValue("StaffID"));
                return clientDataKeyName;

    Angel Petrov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Sreenivas
    Sreenivas avatar
    5 posts
    Member since:
    Mar 2013

    Posted 06 Jun 2013 Link to this post

    Thanks Angel.I did the same and it worked :)
Back to Top