IconUrl with relative path

14 posts, 0 answers
  1. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 25 May 2010 Link to this post

    Is it possible to set the IconUrl property in the RadWindowManager with a relative path like: "~/images/myimage.png" 

    It doesn't seem to be working for me - I get a blank space where the image should be.  I'm trying to do this in a master page.  Thanks.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 May 2010 Link to this post

    Hello James,

    I tried setting the IconUrl and got it working. I am using RadControls version 2010, 1, 309, 35.
    Here is the markup that I used.

    aspx:
     
    <telerik:RadWindowManager IconUrl="../Images/square.png" ID="RadWindowManager1" 
        runat="server" DestroyOnClose="true">  
        <Windows> 
            <telerik:RadWindow ID="W1" NavigateUrl="Window1.aspx" VisibleOnPageLoad="true">  
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 

    Could you provide the code that you tried, if this doesnt help?

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 26 May 2010 Link to this post

    Hi James,

    I tested the following code with the latest RadWindow for ASP.NET AJAX version (2010.1.519), and it works as expected - the image was shown:
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server" IconUrl="~/Files/for test.jpg">
                <Windows>
                    <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="true" NavigateUrl="http://www.google.com"></telerik:RadWindow>
                    <telerik:RadWindow ID="RadWindow2" VisibleOnPageLoad="true" NavigateUrl="http://www.telerik.com"></telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
        </div>
        </form>
    </body>
    </html>
    There was a problem in the previous versions if the path had spaces (e.g. ~/My Path/My File.jpg) . If you remove the spaces(e.g. ~/MyPath/MyFile.jpg) everything should be fine.

    If your project is web application - RadWindow's IconUrl will  work not correctly when you add your application directly to the server root (e.g. ApplicationPath is "/"), otherwise it will work as expected(e.g. Application Path is  "/ApplicationName/"). We already logged this problem and we will fix it in one of our future releases.

    All the best,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 26 May 2010 Link to this post

    Hmmm it is still not working for me.  Here are more details:

    The window manager is defined in a Master page:
    <telerik:RadWindowManager ID="windowManager" runat="server" AutoSize="True" Modal="True" Skin="Outlook" Behaviors="Close, Move" VisibleStatusbar="False" ShowContentDuringLoad="false" style="z-index: 9500" IconUrl="~/images/ts_globe_20.png">  
    </telerik:RadWindowManager> 
             

    The window is being created via javascript:
    function OpenModalWithUrl(url)  
    {  
        var oManager = GetRadWindowManager();  
        if (oManager) oManager.open(url, null);  

    I'm using version 2010.1.415.35 of Telerik, Visual Studio 2008, IE 8, and experiencing this problem in the debugger. 

    If I replace "~/images/ts_globe_20.png" with "images/ts_globe_20.png" or "../images/ts_globe_20.png" (depending on where the page resides), it works.

  6. GT
    GT avatar
    52 posts
    Member since:
    May 2006

    Posted 27 May 2010 Link to this post

    Check the HTML dump of the page where RadWindow is. At the end of the page, you should see something like this:


    Sys.Application.add_init(function() {
        $create(Telerik.Web.UI.RadWindow, {
    .............

    What is the path to the icon there? I don't think the problem is related to the window control (it is the asp.net framework that is responsible for converting the ~ to the app's root) though... it looks more like a configuration issue to me.



  7. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 27 May 2010 Link to this post

    Hello James,

    When you open a RadWindow via the open client-side method it will be created on the client and IconUrl will not be used. The following code is a simple workaround which will change the IconUrl on the client.
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head id="Head1" runat="server">
        <title></title>
         
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
        <script type="text/javascript">
            function OpenModalWithUrl(url)
            {
                var oManager = GetRadWindowManager();
                if (oManager)
                {
                    var oWin = oManager.open(url, null);
                    var iconUrl = oWin.get_iconUrl();
                    // set the new ICon
                    oWin._titleIconElement.style.background = "transparent url('"+iconUrl+"') no-repeat scroll 0px 0px";
                }
            }  
        </script>
         <telerik:RadWindowManager ID="windowManager" runat="server" AutoSize="True" Modal="True" Skin="Outlook" Behaviors="Close, Move"
             VisibleStatusbar="False" ShowContentDuringLoad="false" style="z-index: 9500" IconUrl="~/Files/Gifi.gif">   
            </telerik:RadWindowManager>  
            <button  type="button" value="showIT" onclick="OpenModalWithUrl('http://www.google.com')" ></button>
        </div>
        </form>
    </body>
    </html>
    We will do our best to fix this problem for some of the RadControls for ASP.NET AJAX future releases. Your Telerik points were updated.

    Sincerely yours,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 27 May 2010 Link to this post

    Thanks Petio, that... almost worked for me.

    I noticed that the value of oWin.get_iconUrl() was "//images/ts_globe_20.png".  This was not working.  If I changed the url to either "/images/ts_globe_20.png" or to "//localhost:2331/images/ts_globe_20.png" it works.  I haven't deployed the website yet, all my testing so far has only been in visual studio debugger - I'm not sure if that makes a difference.

    My work around was to update my js method to replace the "//" with "/".
    function OpenModalWithUrl(url)  
    {  
        var oManager = GetRadWindowManager();  
        if (oManager)   
        {  
            var oWin = oManager.open(url, null);  
            var iconUrl = oWin.get_iconUrl();  
            iconUrl = iconUrl.replace("//","/");  
            oWin._titleIconElement.style.background = "transparent url('" + iconUrl + "') no-repeat scroll 0px 0px";  
        }  

    Let me know if there is a better approach.  For now, this appears to work for me but I have yet to deploy it to my web server to test.  Thanks!

  9. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 01 Jun 2010 Link to this post

    Hello James,

    At the moment this is the only one solution. We will do our best to resolve all known issues with RadWindow's IconUrl property till the next official release.
    Let us know if you have any other questions.

    Kind regards,
    Petio Petkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. fred williams
    fred williams avatar
    55 posts
    Member since:
    Feb 2010

    Posted 24 Nov 2010 Link to this post

    Just to chime in here, I had the exact same problem where the icon wouldn't show up during testing. It does however work fine and the icon shows once the application is deployed. I'm not sure if the original poster ever deployed his app but if not he should and then reply here to see if it worked. 
  11. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 16 Jun 2011 Link to this post

    The fix that was suggested with the javascript worked for awhile.  However, after recently upgrading to a newer version of Telerik, it has stopped working and the icon no longer shows up.  We are currently using version 2011.1.413.35
  12. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Jun 2011 Link to this post

    Hi James,

    Just to clarify - is your application set as root website? If so, indeed 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 codebehind, by using the ResolveUrl method:
    radWindow.IconUrl = ResolveUrl ("~/pathToImage/image.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.

    Greetings,
    Georgi Tunev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  13. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 23 Aug 2011 Link to this post

    This one is still not solved in the Q2 version?

    BR,
    Marc
  14. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 24 Aug 2011 Link to this post

    Hello Marc,

    This seems to be working fine on my end: http://screencast.com/t/gGyqrbxxbI. I tested with the Q2 2011 version and with the latest internal build (2011.2.823 as of 24th of August). Since the Q2 release there have been some more improvements on the iconUrl, but they are in its client-side API.


    Kind regards,
    Marin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  15. Sérgio
    Sérgio avatar
    9 posts
    Member since:
    Aug 2008

    Posted 01 Feb 2012 Link to this post

    Thanks very much. This solution works fine with me.

    I think this is a more elegant way to do it (on the aspx side instead of setting it on the codebehind):

    <telerik:radwindowmanager ID="RadWindowManager1" runat="server" IconUrl='<%= ResolveUrl("~/pathToImage/image.png") %>'>


    Edited:
    My "elegant way" works only at certain cases. In other gives me this JScript error:
    this._titleIconElement.style.background="transparent url('"+c+"') no-repeat scroll 0px 0px";

    I moved all to codebehind and works fine.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017