MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

What is the correct way to include jQuery-ui.css from a cdn in Monox?  (Mono Support )

Viewed 15687 time(s), 6 post(s) 5/7/2012 1:43:41 PMby Jeremy

Related topics

Jeremy

Jeremy

5/7/2012 1:43:41 PM
Is there a setting in Monox for jQuery UI cascading style sheets (css) to be delivered by a content delivery network (cdn) like the javascript files?

I am looking for a setting that will add this:


These are the settings for the javascript in the web.config:

This content has not been rated yet. 
322 Reputation 36 Total posts
denis

denis

5/7/2012 3:41:16 PM
There is no such config setting - however, if you call PageUtility.InjectJQuery method, it registers the jQuery UI js file by taking it from the web.config. The same method also tries to register the CSS with the same name from the same location (it replaces .min.js with .css), so there is no need for a separate setting.
If you need to do it manually, you can call a method HtmlFormatter.CreateCssLink and pass it the URL of your CSS file.
Rated 5.00, 1 vote(s). 
7207 Reputation 956 Total posts
Jeremy

Jeremy

5/8/2012 8:57:43 AM
Unfortunately the automatic setting results in an incorrect link being added to my pages:
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.css" rel="stylesheet" type="text/css" />

IE9 developer tools give a misleading error message "This stylesheet cannot be viewed because its source is in a different domain than the page." The file does not exist. Google gives a 404 error.

So I will have a look at the manual setting. Is there any way to stop the automatic css link from being added?
This content has not been rated yet. 
322 Reputation 36 Total posts
denis

denis

5/8/2012 12:27:16 PM
By default, it is being applied only for admin users in the Main.master page. You cannot avoid it in this version, but you can manually register your own CSS URL.
This content has not been rated yet. 
7207 Reputation 956 Total posts
Jeremy

Jeremy

5/8/2012 9:45:16 PM

Thank you for the clarification. I had been doing all my testing as admin. I can live with the incorrect link under those circumstances for the benefits of using a cdn. I have been able to successfully manually add the css using the method you described:

using MonoSoftware.Web;
 
    protected void Page_Load(object sender, EventArgs e)
    {
    }


Thank you.

This content has not been rated yet. 
322 Reputation 36 Total posts
khorvat

khorvat

5/8/2012 11:17:11 PM
Hi,

we have logged in your suggestion / issue as a feature request so we will decide if this will be implemented in the next release.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts