Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...ClientID has a space in itClientID has a space in it
Previous
 
Next
New Post
7/25/2009 3:57 PM
 

I am porting an existing application to a DotNetNuke module and discovered bizarre behavior. I use ClientID when creating javascript so that the code can identify the HTML elements. Normally that creates a value something like this:

"g_ctl00_ctl01_ctl00_ctl00_txtSearch"

We've all seen this a million times, right? Well, after porting this code to a DotNetNuke module and running it for the first time, the ClientID property is returning this:

"dnn_ctr397_GalleryServerPro.Web.Gallery, TechInfoSystems_ctl00_ctl01_ctl00_ctl00_txtSearch"

Notice the comma and the space. This is causing all kinds of javascript errors. For example, the ASP.NET Login control is now outputting invalid

var dnn_ctr397_GalleryServerPro.Web.Gallery, TechInfoSystems_ctl00_ctl01_ctl01_lv_ctl02_Login1_UserNameRequired = document.all ? document.all["dnn_ctr397_GalleryServerPro.Web.Gallery, TechInfoSystems_ctl00_ctl01_ctl01_lv_ctl02_Login1_UserNameRequired"] : document.getElementById("dnn_ctr397_GalleryServerPro.Web.Gallery, TechInfoSystems_ctl00_ctl01_ctl01_lv_ctl02_Login1_UserNameRequired");

My module has an assembly name of TechInfoSystems.GalleryServerPro.dll, the default namespace is GalleryServerPro.Web, and the user control is in a class named Gallery.cs, so that partially explains where some of that extra text is coming from, but why is it there? And what can I do to ensure that ClientID does not output commas, spaces, or other characters that can cause problems in javascript?

Thanks, Roger

 
New Post
7/27/2009 5:06 PM
 

Can you post some example code of your module?  I have not seen anything with DNN in the past that would generate IDs that look like that.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
7/29/2009 10:55 AM
 

I (sort of) figured it out. I needed to add an ID to the user control that is being added to the DotNetNuke page. This is the main view user control - the one that inherits PortalModuleBase. The user control is contained entirely in a code-behind class (no .ascx), so adding this to the Init event fixed everything:

this.ID = "gsp";

My theory is that the issue happens when these are true:

1. The "view" user control uses only the code-behind file (no .ascx file)

2. The user control does not have an ID specified.

When registering a module without the .ascx, one must specify the class and assembly in the Module Definitions. In my case, it is "GalleryServerPro.Web.Gallery, TechInfoSystems.GalleryServerPro". That looks very close to the text DNN ends up inserting into the clientID string. DNN (or ASP.NET) must be taking that string and using it to build the clientID in the absense of an ID assigned in the user control.

Not sure if this is a DNN bug, but I am happy to figure it out and now can move on...

Roger Martin

Gallery Server Pro


 
New Post
7/30/2009 1:53 PM
 

Hey Roger,

I had no idea you could register and actually use a module without a user control. Do you mind showing us what your registration (manifest file) looks like? Also, what happens when you drop the module on a page?

Thanks,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
New Post
8/2/2009 1:38 PM
 

Well, it *is* a user control, it just does not have the .ascx declarative file. In other words, I created a regular class and had it implement PortalModuleBase like this:

public class Gallery : DotNetNuke.Entities.Modules.PortalModuleBase

Then, in the manifest, notice how I reference the Gallery class instead of a .ascx file:

                <component type="Module">
                    <desktopModule>
                        <moduleName>TechInfoSystems.GalleryServerPro</moduleName>
                        <foldername>GalleryServerPro</foldername>
                        <businessControllerClass>GalleryServerPro.Web.GalleryServerProController</businessControllerClass>
                        <supportedFeatures />
                        <moduleDefinitions>
                            <moduleDefinition>
                                <friendlyName>Gallery Server Pro</friendlyName>
                                <defaultCacheTime>0</defaultCacheTime>
                                <moduleControls>
                                    <moduleControl>
                                        <controlKey />
                                        <controlSrc>GalleryServerPro.Web.Gallery, TechInfoSystems.GalleryServerPro</controlSrc>
                                        <supportsPartialRendering>False</supportsPartialRendering>
                                        <controlTitle />
                                        <controlType>View</controlType>
                                        <iconFile />
                                        <helpUrl />
                                        <viewOrder>0</viewOrder>
                                    </moduleControl>
                                </moduleControls>
                            </moduleDefinition>
                        </moduleDefinitions>
                    </desktopModule>
                    <eventMessage>
                        <processorType>DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke</processorType>
                        <processorCommand>UpgradeModule</processorCommand>
                        <attributes>
                            <businessControllerClass>GalleryServerPro.Web.GalleryServerProController</businessControllerClass>
                            <desktopModuleID>[DESKTOPMODULEID]</desktopModuleID>
                            <upgradeVersionsList>01.00.00</upgradeVersionsList>
                        </attributes>
                    </eventMessage>
                </component>
 

The reason I did it this way is two-fold:

1. The application I am porting from is already architected this way and I want to minimize changes.

2. The original app was this way because the Gallery user control can be thought of as a controller class whose job it is is to determine - based on query string - which user control to load. IOW, this control's primary job is to dynamically load the desired control. As such it has no UI and no need for a .ascx file.

As for what it looks like when dropped on a page, I believe it looks like any other module, since it *is* a user control and inherits from PortalModuleBase.

The original, unported application is an open source gallery and can be found at Gallery Server Pro.

Hope this helps,

Roger

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...ClientID has a space in itClientID has a space in it


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out