JQuery Plugin on Layout.Master

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/20/2010 9:58:41 AM
Gravatar
Total Posts 42

Re: JQuery Plugin on Layout.Master

Greetings

I have a custom control that loads jquery maphighlight and some other custom jquery stuff. However, when I place the control following the scriptloader (or anywhere else of that matter) it breaks the jquery on the page security settings. I get the following error:

o.easing[this.options.easing || (o.easing.swing ? "swing" : "linear")] is not a function

My control:

<%@ Control Language="C#" ClassName="jQueryLSCUserControl" %>
<script type="text/javascript" src="http://....../clientscript/jquery/jquery.maphighlight.min.js"></script>
<script type="text/javascript" src="http://....../clientscript/jQueryLSC.js"></script>
 

jQuery:

$(function() {
// map highligher
$('.buildingMap').maphilight();
});
 

4/20/2010 12:04:19 PM
Gravatar
Total Posts 18439

Re: JQuery Plugin on Layout.Master

Hi Steve,

I would not try to include the scripts the way you are doing it. I would create a method in code named SetupScript() and call it from the page load of the user control. In the SetupScript() method use code like this:

Page.ClientScript.RegisterClientScriptBlock(typeof(Page),
                    "idforyourscript", "\n<script src=\""
                    + Page.ResolveUrl("~/ClientScript/path/to/uoirscript.js") + "\" type=\"text/javascript\" ></script>");

I would use StringBuilder from your user control to setup the jquery init script and you need to add it like this example:

string initAutoScript = " $('div.mojo-accordion').accordion(); $('div.mojo-accordion-nh').accordion({autoHeight: false}); $('div.mojo-tabs').tabs(); ";

 Page.ClientScript.RegisterStartupScript(typeof(Page),
    "myui-init", "\n<script type=\"text/javascript\" >"
     + initAutoScript + "</script>");

Hope it helps,

Joe

4/20/2010 12:16:05 PM
Gravatar
Total Posts 18439

Re: JQuery Plugin on Layout.Master

Oh, and thanks for permission to link to your documentation Steve!

I've linked to it from http://www.mojoportal.com/community-tutorials.aspx

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.