[CLOSED] Coolite.axd throwing errors for icon css

  1. #1

    [CLOSED] Coolite.axd throwing errors for icon css

    I defined my own css file for displaying coolite icon, but Coolite.axd is throwing exceptions when it tries to load the icon.

    .icon-newreport { background-image: url(../icons/add-png/coolite.axd) !important;}
    The css file is located under a folder in the root. Using fiddler, I see it is trying to hit

    http://m52f/mustache/icons/delete-png/coolite.axd

    which is correct. The weird thing is that this only affects SOME icons but not all. If I change the icon from add-png to disk-png, it works fine. Here's the exception that's being thrown:


    System.NullReferenceException: Object reference not set to an instance of an
    object. at Coolite.Ext.Web.ResourceManager.ProcessRequest(Htt pContext context)
    at
    System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e()
    at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
    completedSynchronously)


  2. #2

    RE: [CLOSED] Coolite.axd throwing errors for icon css

    Hi jchau,

    With the embedded Icons, you need to include the full path to the root of the Application. Given your code sample I would suspect the name "mustache" is your Application name. I think the following revised code sample should work.


    .icon-newreport { background-image: url(/mustache/icons/delete-png/coolite.axd) !important;}

    But... as a general rule I would recommend only using the embedded resources programtically. While hard linking to the files is certainly possible, the odds of something changing (and not working) after you deploy is increased. 


    For the Icons there are several helper Methods available from the <ext:ScriptManager>.


    1. RegisterIcon - Creates and adds the css class into the <head> of your &#100;ocument. Try adding the following line to your Page_Load event, then view the Html source rendered to the browser (View > Source). You should see a new .icon-delete css class and the correct url path will be defined. That path is the one you should be using in your original code sample.


    this.ScriptManager1.RegisterIcon(Icon.Delete);

    2. GetIconUrl - Gets the url to the embedded resource Icon. The url is affected by the <ext:ScriptManager> .CleanResourceUrl property. If CleanResourceUrl="false", then the url path returned by GetIconUrl will be the typical ugly autogenerated WebResource.axd path. 


    this.ScriptManager1.GetIconUrl(Icon.Delete);

    3. GetIconClass - Gets the full css class specification for the Icon. 


    this.ScriptManager1.GetIconClass(Icon.Delete);

    If you have copied the "Coolite - Drag into your Project [not required]", then please just direct link to those files. If your icon url has the "/coolite.axd" extension, then you are linking to the icon .png file stored within the .dll, which is different than "/Coolite/" folder which you may have dragged into your project. 


    Hope this helps.


    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: [CLOSED] Coolite.axd throwing errors for icon css

    Thanks Geoffrey. Mustache is the website code name so I do not want to hardcode that into the css file. We name the website differently for testing vs production. I will try the RegisterIcon method. Any thoughts of automatically creating an external file for the css icons instead of writing them to the html so it can take advantage of browser caching? I may have 20 icons on the page and the html looks cleaner without those css classes defined in the head.
  4. #4

    RE: [CLOSED] Coolite.axd throwing errors for icon css

    Any thoughts of automatically creating an external file for the css icons instead of writing them to the html so it can take advantage of browser caching?
    Yes, add the image files to your project/website and within your css just link to them as you typically would any other image. 


    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. [CLOSED] Mask throwing HttpException
    By fordprefect in forum 1.x Premium Help
    Replies: 3
    Last Post: Dec 14, 2011, 9:11 PM
  2. [CLOSED] How can I use Coolite Icon in javaScript
    By RomualdAwessou in forum 1.x Premium Help
    Replies: 9
    Last Post: Apr 14, 2011, 4:44 PM
  3. [CLOSED] [1.0] Calendar throwing exception
    By Timothy in forum 1.x Premium Help
    Replies: 1
    Last Post: Mar 25, 2011, 12:21 AM
  4. Add Icon in Coolite.
    By flaviodamaia in forum 1.x Help
    Replies: 2
    Last Post: Mar 27, 2009, 7:54 PM
  5. Consistently getting errors using Coolite
    By r_honey in forum 1.x Help
    Replies: 12
    Last Post: Dec 14, 2008, 6:23 AM

Posting Permissions