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

IconUrl set from Skin using incorrect path

5 Answers 102 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jerome
Top achievements
Rank 1
Jerome asked on 18 Jun 2012, 06:15 PM
I'm trying to set the IconUrl for a RadWindow from a .skin file, thusly:

<telerik:RadWindow runat="server" SkinID="AddPersonNoteWindow"
    IconUrl="Images/Icons/note_add.png" />

The value is applying, however it's coming out incorrect:

background-image: url("//App_Themes/Default/Images/Icons/note_add.png")

The double forward slashes near the beginning cause the icon to not work.

What's up with this?

[EDIT]

Seems unrelated to the Skin file. When I set the icon without the skin file, I get the same issue.

I think the Telerik code should probably not generate these double slashes.

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 20 Jun 2012, 10:09 AM
Hello Jerome,

Does the page with the RadWindow exists in the site's root? If so, this problem was reported several times during the years and our investigation shows that the problem is not directly related to our control, but to the way the framework works. Basically, our control does not affect the URL in any way - we leave this entirely to the framework's URL resolving logic. 

There seems to be a problem with Request.ApplicationPath in some specific scenarios - check this blog post for more details. As you will see, the problem occurs with the standard controls as well.

This being said, I would suggest to set the IconUrl property from code-behind, by using the ResolveUrl method, e.g.:
AddPersonNoteWindow.IconUrl = ResolveUrl("~/Images/Icons/note_add.png")


I hope this helps. If it doesn't, or your scenario is different than the one described in the blog post, please provide more details about your exact setup so we can investigate further.


Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jerome
Top achievements
Rank 1
answered on 20 Jun 2012, 03:17 PM
No, the page exists in a subfolder called Pages.

I'm trying to avoid setting the IconUrl from the Page at all, let alone the code behind. I'm trying to set it from a .skin file. The example <telerik:RadWindow> tag that I showed you in my example is from a .skin file.

If the .skin file exists in App_Themes/Foo.skin, the path I set in the Skin file should be relative to the .skin file. And actually, it is. It's smart enough to put App_Themes in the url. It's just the double slash in front of it that breaks it.
0
Marin Bratanov
Telerik team
answered on 22 Jun 2012, 12:40 PM
Hi Jerome,

I tried this scenario and things appear to be functioning properly with me. I am attaching here the files I used for testing (a simple theme and the page that uses it) along with a screenshot with the behavior on my end. I deployed the site to a virtual directory in my IIS as well (you can see this in the URL of the browser). Does this sample work fine in your case? If the URL for the RadWIndow is incorrect is the image's src correct? If it is not then there is something in your specific environment that is causing the framework to break the  URLs and it is not coming from the RadWindow. In case the RadWindow does not work properly, but the image does could you send me back the modified pages that show this behavior (or a small runnable project in case these files alone, i.e. outside of your environment, cannot show the problem)?

Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jerome
Top achievements
Rank 1
answered on 22 Jun 2012, 03:36 PM

Hmm. Well, this is going to be obnoxious. The site has a lot of stuff in it, so stripping out stuff to come up with a test case is going to be hard. Here is the Javascript generated by the RadWindow:

$create(Telerik.Web.UI.RadWindow, {"_dockMode":true,"autoSize":true,"behaviors":4,"clientStateFieldID":"ctl00_ctl00_MasterPagePartnerLayoutPlaceHolder_MasterPagePartnerImplContentPlaceHolder_AddPersonNoteWindow_ClientState","formID":"aspnetForm","iconUrl":"//App_Themes/Default/Images/Icons/note_add.png","minimizeIconUrl":"//App_Themes/Default/Images/Icons/note_add.png","modal":true,"name":"AddPersonNoteWindow","skin":"Metro","title":"New Person Note","visibleStatusbar":false}, null, null, $get("ctl00_ctl00_MasterPagePartnerLayoutPlaceHolder_MasterPagePartnerImplContentPlaceHolder_AddPersonNoteWindow"));

Notice the IconUrl value which is being set.

I'll see if I can figure out how to get a test case for this, I guess. The site has multiple masterpages, swapped out dynamically, and such. So...

0
Marin Bratanov
Telerik team
answered on 26 Jun 2012, 09:59 AM
Hello Jerome,

The value that gets serialized to the client is sent as-is from the server, which is where the problem originates.The steps in this blog post can be helpful in isolating a sample and can also help finding the cause of the issue by stripping things one by one. What happens if you set the URL for the ImageUrl properly of a simple image control in your theme, as I do in my sample. Does it get a correct URL? If not - then there isn't anything we can do, as this is what we get from the framework itself.

On a side note - if it is possible in your case you can try adding a full URL, e.g. http://mysite.com/images/icon.png to the property and see if the framework changes it.


Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Jerome
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Jerome
Top achievements
Rank 1
Share this question
or