GridTemplateColumn problem

2 posts, 1 answers
  1. Stefania
    Stefania avatar
    100 posts
    Member since:
    May 2013

    Posted 16 Jul 2014 Link to this post

    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">
                                   <asp:Label Text='<%#Eval("Field1") %>' runat="server"></asp:Label>

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

    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">                       

    it works but still I don't have the tooltip

  2. Answer
    Marin avatar
    1038 posts

    Posted 21 Jul 2014 Link to this post


    <%#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">
                        <span title="#=Field1#"> #=Field1#</span>

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


    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top