3 Comments

Having been busy with a small DotNetNuke-based project lately so here’s a short “how-to” for those who want to use jQuery in their own DNN-modules. This applies to DNN 5.0 and newer.

1. Installing jQuery

DNN by default includes the jQuery library so no manual installation is required. You can check the jQuery version from Host – Host settings – Advanced Settings – JQuery settings. This is also the place where you can make DNN to use Microsoft’s or Google’s CDN to deliver the library. If your module targets the version 5.0 of DNN (actually, 4.9.1) or newer, you can be sure that every installation includes the jQuery.

dnn_jquery

2. Request jQuery in code-behind

In your module, make sure to request for jQuery in code-behind class. Module’s Load-event is excellent place for this:

   1: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   2:
   3:     Try
   4:
   5:         If Not Page.IsPostBack Then
   6:
   7:             DotNetNuke.Framework.jQuery.RequestRegistration()
   8:
   9:         End If
  10:
  11:     Catch exc As Exception
  12:         ProcessModuleLoadException(Me, exc)
  13:     End Try
  14:
  15: End Sub

3. Use the jQuery-word instead of $-character

For some reason the widely used jQuery-shortcut ‘$’ doesn’t always work properly inside the DotNetNuke. So it’s better to use the word jQuery instead. Here’s an example of using jQuery in the traditional way:

   1: <script type="text/javascript">
   2:     $(document).ready(function() {
   3:         $("#featured > ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 7500, true);
   4:     });
   5: </script>

In DotNetNuke it’s better to write the function like the following:

   1: <script type="text/javascript">
   2:     jQuery(document).ready(function() {
   3:         jQuery("#featured > ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 7500, true);
   4:     });
   5: </script>
And that’s it. Following these small steps you can easily use jQuery to enhance the functionalities of your custom DNN modules.

0 Comments

New week, new NServiceBus related information. Remember to send a message if something is amiss. 

News

Tutorials and Articles

Community

  • NServiceBus and Windows Identity Foundation - From the Yahoo NServiceBus Group, Periop IT asks for advices regarding WIF (Windows identity foundation) and NServiceBus. 
  • Biztalk integration with NServiceBus - Highly interesting question by shawn. Udi jumps in and points out that some of the interoperability issues between NServiceBus and Biztalk has been fixed in the 2.5 version.
  • New NSB user - architectural/design questions - Couple interesting answers to this architecture related question. What is a system and what is a service? Read on to find out.
  • Design/guidelne - Similar to the previous question, this one deals with the architecture of NServiceBus systems.
  • Multicast with NSB - Andreas Öhlund and Udi Dahan help Alberto to define what is the role of NServiceBus in his system. Contains many good answers, be sure to check them out.

That's it until next week. Happy coding!

Got an interesting NServiceBus related link? Did I miss something? Link not working? Please, send mail or contact @MikaelKoskinen.

0 Comments

Here’s a snippet which has saved me a great deal of time lately. It’s a simple function which takes in a XmlSchema-object and returns it in a string-format.

<span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">Private</span> <span style="color: #0000ff">Function</span> SchemaAsString(<span style="color: #0000ff">ByVal</span> schema <span style="color: #0000ff">As</span> XmlSchema) <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>

<span id="lnum2" style="color: #606060">   2:</span>&nbsp; 

<span id="lnum3" style="color: #606060">   3:</span>     Using memStream <span style="color: #0000ff">As</span> <span style="color: #0000ff">New</span> MemoryStream(1024)

<span id="lnum4" style="color: #606060">   4:</span>&nbsp; 

<span id="lnum5" style="color: #606060">   5:</span>         schema.Write(memStream)

<span id="lnum6" style="color: #606060">   6:</span>         memStream.Seek(0, SeekOrigin.Begin)

<span id="lnum7" style="color: #606060">   7:</span>&nbsp; 

<span id="lnum8" style="color: #606060">   8:</span>         Using reader <span style="color: #0000ff">As</span> <span style="color: #0000ff">New</span> StreamReader(memStream)

<span id="lnum9" style="color: #606060">   9:</span>&nbsp; 

<span id="lnum10" style="color: #606060">  10:</span>             <span style="color: #0000ff">Dim</span> result = reader.ReadToEnd

<span id="lnum11" style="color: #606060">  11:</span>             <span style="color: #0000ff">Return</span> result

<span id="lnum12" style="color: #606060">  12:</span>&nbsp; 

<span id="lnum13" style="color: #606060">  13:</span>         <span style="color: #0000ff">End</span> Using

<span id="lnum14" style="color: #606060">  14:</span>&nbsp; 

<span id="lnum15" style="color: #606060">  15:</span>     <span style="color: #0000ff">End</span> Using

<span id="lnum16" style="color: #606060">  16:</span>&nbsp; 

<span id="lnum17" style="color: #606060">  17:</span> <span style="color: #0000ff">End</span> Function

This is useful if you obtain a XmlSchema-object from somewhere and want to do some Linq to Xml queries over it.

The original code was found from the StackOverflow.

0 Comments

Our latest NServiceBus Weekly may seem short but I think that the tutorials and articles will keep you busy for the next week. Included are excellent posts by Jonathan Oliver and Adam Fyles and also a hour and a half long video podcast by Udi Dahan.

Tutorials and Articles

Community

  • Win Service getting permission denied to Message Queuing- For those users struggling with the NServiceBus in Windows 7 environment. Bob The Janitor found a solution to his own problem by modifying the permissions.
  • NServiceBus and .Net 1.1 – Vijay would like to use NServiceBus with .NET Framework 1.1. Unfortunately that’s not supported. Ducttapeman points out a really good reason for upgrading your 1.1 applications to a newer framework: Microsoft is not supporting the 1.1 version anymore.

That’s it for today.

Got an interesting NServiceBus related link? Did I miss something? Link not working? Please, send mail or contact @MikaelKoskinen.

0 Comments

When using NHibernate with an Oracle db, executing a stored procedure is simple. But it has a twist. Instead of using the keyword “exec”, you must use “call”.

<span id="lnum1" style="color: #606060">   1:</span> var query = session.CreateSQLQuery(<span style="color: #006080">"call MY_PROCEDURE ('Param1', 'Param2')"</span>);

<span id="lnum2" style="color: #606060">   2:</span> query.ExecuteUpdate();