Monday, January 4, 2010

Customizing Telerik RadGrid tooltips

Today I had to customize the Telerik RadGrid tooltips.

Overriding the hardcoded tooltips

Looking around in the Telerik documentation I found this article. The article shows which properties to use so you can override the hardcoded tooltips.

Being consistent using ASP.NET Themes

It's a best practice to put styles which apply to multiple controls in a Skin using Themes.

This skin looked something like this.

   1:  <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
   2:   
   3:  <telerik:RadGrid 
   4:      runat="server"    
   5:      SortingSettings-SortToolTip="Sorteren"
   6:      PagerStyle-LastPageToolTip="Laatste pagina"                    
   7:      PagerStyle-NextPageToolTip="Volgende pagina"
   8:      PagerStyle-FirstPageToolTip="Eerste pagina" 
   9:      PagerStyle-PrevPageToolTip="Vorige pagina"    
  10:      PagerStyle-PagerTextFormat="Pagina {0}/{1} | Records {2} - {3} | {4} {5} records">
  11:  </telerik:RadGrid>

Don't forget to register the Telerik Assembly!

Localizing the tooltips

ASP.NET WebForms does not provide support to localize Skins.

If you do try you will receive the runtime error "Expressions are not allowed in Skin files" (Been there, done that).

Applying the theme to all RadGrids

I didn't add a SkinID, because I want the skin to apply to all RadGrids without setting the SkinID on every RadGrid. You can simply modify the pages element in your web.config to apply the Theme to your whole webapplication.

   1:  <configuration>
   2:      <system.web>
   3:          <pages theme="ThemeName" />
   4:      </system.web>
   5:  </configuration>

No comments:

Post a Comment