Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > New webpart custom javascript View modes: 
User avatar
Member
Member
poostwoud-gmail - 10/24/2011 10:00:35 AM
   
New webpart custom javascript
Hello,

I'm trying to create a new webpart based on CMSListMenu. To make the new webpart work I need to load a jQuery script file.

Of course it should only be loaded when the user used the new webpart, but how can I handle automatic placement of this code? I've checked the caroussel webpart, however this seems quite different from the CMSListMenu in the way it's handled.

How can I make this work?

Cheers,

Peter

User avatar
Kentico Support
Kentico Support
kentico_radekm - 10/25/2011 5:50:42 AM
   
RE:New webpart custom javascript
Hello.

To load jQuery libraries into your custom ascx file you can use general .NET methods:

ClientScriptManager csm = Page.ClientScript;
csm.RegisterClientScriptInclude("verticalscroll", ResolveClientUrl("~/js/file.js"));


Or our API and corresponding method in CMS.GlobalHelper.ScriptHelper class.

Since this code is a part of the web part, it loads the code when web part is placed on a page only.

Best Regards,
Radek Macalik