New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

The GetWebResourceUrl Method Fails


Product Progress® Telerik® UI for ASP.NET AJAX


When working with Telerik UI for ASP.NET AJAX, the GetWebResourceUrl method fails.


As of Q3 2011, all built-in skins are located in the Telerik.Web.UI.Skins.dll assembly. Therefore, the GetWebResourceUrl method cannot get a proper URL for the stylesheet or image you are trying to reference as the assembly it searches in is Telerik.Web.UI.dll and since the controls themselves are located there.


If you are using the GetWebResourceUrl method, you need to replace it with its analogue from the SkinRegistrar class, for example:

<link href='<%= Telerik.Web.SkinRegistrar.GetWebResourceUrl(this, typeof(RadEditor), "Telerik.Web.UI.Skins.Outlook.Editor.Outlook.css") %>' rel="stylesheet" type="text/css" />

This example registers the Editor Outlook skin-specific stylesheet. If you are using VB, change this to Me and typeof to GetType as is the equivalent in this language.

Server code blocks may cause issues in the head section of the page where link elements are usually placed so you can wrap them in a CodeBlock control. Otherwise, a server error may be thrown or the code may not be executed, that is, the link will not work.

For more information about this method and WebResources in general, refer to the Easily Access Embedded Resources with Telerik RadControls for ASP.NET AJAX blog post.

In this article