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

GridTemplateColumn problem

1 Answer 90 Views
ClientDataSource
This is a migrated thread and some comments may be shown as answers.
Stefania
Top achievements
Rank 2
Stefania asked on 16 Jul 2014, 03:07 PM
Hi,
How can I add a GridTemplateColumn in my grid with label and tooltip and take the data from a field of my object

I tried something like 
<telerik:GridTemplateColumn UniqueName="Bt1" DataField="Field1">
                           <ItemTemplate>
                               <asp:Label Text='<%#Eval("Field1") %>' runat="server"></asp:Label>
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>

<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="true">     
       <ClientEvents OnDataParse="LoadImageGrid" OnChange="LoadBigMap" />
       <DataSource>
           <WebServiceDataSourceSettings>
               <Select Url="load_map.asmx/GetHomeData" RequestType="Post" DataType="JSON" ContentType="application/json; charset=utf-8" />
           </WebServiceDataSourceSettings>
       </DataSource>
       <Schema>
           <Model>
               <telerik:ClientDataSourceModelField FieldName="Field1" DataType="String" />
               <telerik:ClientDataSourceModelField FieldName="Field2" DataType="String" />
              ...
           </Model>
       </Schema>  
   </telerik:RadClientDataSource>

But it doesn't show any text..
and I have no idea how to add a tooltip

If I try with
<telerik:GridBoundColumn UniqueName="Bt1" DataField="Field1" HeaderText="BT1" AllowFiltering="false">                       
                      </telerik:GridBoundColumn>

it works but still I don't have the tooltip

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 21 Jul 2014, 05:35 PM
Hi,

<%#Eval("Field1") %> is a server-side databinding expression so it will not work in case of client-side binding of the grid. Instead you can use the ClientItemTemplate of the GridTemplateColumn and specify there client-side binding templates using only HTML elements, because server-side controls are not supported in this case. Here is a short example:
<telerik:GridTemplateColumn UniqueName="TemplateColumn1" HeaderText="TemplateColumn1">
                <ClientItemTemplate>
                    <span title="#=Field1#"> #=Field1#</span>
                </ClientItemTemplate>
            </telerik:GridTemplateColumn>

More information on the ClientItemTemplate of the template column can also be found in this demo.

Regards,
Marin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ClientDataSource
Asked by
Stefania
Top achievements
Rank 2
Answers by
Marin
Telerik team
Share this question
or