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

Formated Eval as ClientDataKeyNames

2 Answers 35 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Sreenivas
Top achievements
Rank 1
Sreenivas asked on 02 Jun 2013, 11:07 AM
Hello,

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%" >
                                                    <ItemTemplate>
                                                    <%# String.Format("{0}-{1}", Eval("ID"), Eval("StaffID"))%>    
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 05 Jun 2013, 12:51 PM
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.

ASPX:

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

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


Regards,
Angel Petrov
Telerik
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.
0
Sreenivas
Top achievements
Rank 1
answered on 06 Jun 2013, 11:50 AM
Thanks Angel.I did the same and it worked :)
Tags
Sharepoint Integration
Asked by
Sreenivas
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Sreenivas
Top achievements
Rank 1
Share this question
or