GridTemplateColumn problem

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

    Posted 16 Jul 2014 Link to this post

    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
  2. Answer
    Marin
    Admin
    Marin avatar
    1045 posts

    Posted 21 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top