Michael Flanakin's Web Log

Comments and complaints on software and technology in general

  Home  |   Contact  |   Syndication    |   Login
  159 Posts | 18 Stories | 88 Comments | 530 Trackbacks

News

This weblog is no longer being maintained. For the latest, check out www.michaelflanakin.com!

Article Categories

Archives

Post Categories

Image Galleries

Miscellaneous

After having this problem several times and continually forgetting the fix, I figured I'd go ahead and make a post about it. Hopefully, it'll save someone time in the future. Let me know if you have a different fix.

Symptoms

When you browse to a DNN page after adding a new module to the page, you receive an error message that is similar to the following:

Multiple controls with the same ID 'ctr123_DD' were found. FindControl requires that controls have unique IDs.

Cause

DNN dynamically loads modules to the page when it loads and references them using the Control.FindControl() method. As the error specifies, FindControl() can only be used when all IDs are unique. This usually happens when a module definition has been recently modified. DNN modules are identified using a combination of the key and type properties. To specify the control that should be loaded when a user browses to a page with the module, the key should be blank and the type should be "View". The default edit control (i.e. Add content) and the settings controls should have key values of "Edit" and "Settings", respectively. All other controls need to have unique key values. When non-unique key values are used, DNN loads all of the controls with the same ID, which is the true culprit.

Resolution

First, you'll have to know what module is causing the problem. If you are unsure of which module is causing the problem, there are three ways to figure it out:

  1. If a module was just added to the page before the error occurred, the module that was added is most likely the problem. (Cause you needed me to tell you that, right?)
  2. If a module on the page that's giving you the error was just added, that module is most likely causing the error. (Another great hint!)
  3. If neither of the previous identification methods work, the module ID is listed in the error. "ctr123_DD" refers to module 123. Take a look in the dnn_Modules table and the row with that ModuleId is definitely the problem.

After finding the offending module, browse to the module definitions page (Host > Module Definitions) and check to ensure all module controls have unique key values. Remember: default view is blank, default edit is "Edit", settings is "Settings", and all others can be whatever makes your little heart go pitter-patter. Once the key values are corrected, you will most likely have to restart IIS. The quickest way to do this is to use iisreset (Start > Run, type iisreset, click OK).

More Information

  • Applies to: DotNetNuke 1.0 - 3.1 (I don't think it's been fixed in newer releases, yet; but I haven't confirmed anything newer than 3.1)
  • There is another error that does not specify the module ID, "Multiple controls with the same ID 'ctr' were found." This fix does not apply to those. If/when I run into that one again, I'll try to post a fix on that, too.
    I may have found the cause of the 'ctr' error. It seems that this is caused with malformed HTML within the ASCX and/or mis-matched assembly (I didn't notice there was a build error because VS was saying it built successfully, for some reason.) This happened right after editing a module control, so I just opened the ASCX file in the designer and solved the problem pretty easily. I'm pretty sure this also happened when I wasn't customizing a control, but I can't really remember. That's all I really have right now. Hope it helps someone.

posted on Friday, November 25, 2005 10:58 AM

Feedback

# re: DNN and the Lovely "Multiple controls with the same ID" Error 12/8/2005 1:45 AM clintjohnson
I am having the exact problem you are describing... but the moduleID is not displayed and I am using DNN 3.0.13... in the last few lines of your blog, you say you have not found the fix yet for this problem...
please HELP me !!

# re: DNN and the Lovely "Multiple controls with the same ID" Error 12/8/2005 4:42 AM Michael Flanakin
Have you installed or added any new modules to the site or page you're attempting to access? Try browsing to a different tab ID page and see if that comes up. For instance, if your page is /.../tabid/36/Default.aspx, try /.../tabid/37/Default.aspx. If you can get to another page, then that means the page you were on is just messed up, which is most likely the problem.

I've fixed the error before, but don't remember how. Try doing an IISRESET (from command line) and then browse to the site again. If I could recreate the problem, I would. I get crap from my developers whenever it comes up because I don't remember how to fix it and it always seems to fix itself. If you have a fix, let me know!

# re: DNN and the Lovely "Multiple controls with the same ID" Error 12/20/2005 6:02 PM Michael Friedgeim
It also a good idea to open the Log Viewer from Admin Menu. It will give you full exception details, which can be useful.

# re: DNN and the Lovely "Multiple controls with the same ID" Error 1/25/2006 5:37 PM Frank B
thank you!!!!!!!! This has been very frustrating and a simple mistake can kill you

# re: DNN and the Lovely "Multiple controls with the same ID" Error 2/13/2006 6:50 PM Scot Darr
1. Make sure all site permissions are set up for DNN.

2. Install all default user modules

http://localhost/install/install.aspx?mode=installresources

replace localhost with your host name.

3. Make sure all 3rd party modules have been added.


# re: DNN and the Lovely "Multiple controls with the same ID" Error 2/18/2006 5:43 PM Antonio Chagoury
I usually just remove and re-add the module. That seems to do the trick for me.

# re: DNN and the Lovely "Multiple controls with the same ID" Error 5/18/2006 8:07 AM ravindra jumrani
I am also facing the same problem but i am unable to find it out. Actually i have customised the skins module with my requirements it was working fine until recently when i clicked on skin image for preview it showed me following error "A critical error has occurred.
Multiple controls with the same ID '_Portals__default_' were found. FindControl requires that controls have unique IDs."
I am unable to trace it. Any help from anyone on this. Thanks in advance


# re: DNN and the Lovely "Multiple controls with the same ID" Error 5/18/2006 1:35 PM Michael Flanakin
I'd revert back to the original module provided with DNN and see if that solves your problem. From here, start adding your features back one-by-one until you find the problem.

# re: DNN and the Lovely "Multiple controls with the same ID" Error 1/21/2007 7:31 PM Anthony Glenwright
Thanks for posting this Michael - I just got this one while testing a new module, and your post helped be fix it up in a minute (rather than the hours it would have taken for me to figure it out!)

# re: DNN and the Lovely "Multiple controls with the same ID" Error 1/23/2007 11:36 AM Michael Flanakin
Glad I could be of assistance! :-)

# re: DNN and the Lovely "Multiple controls with the same ID" Error 1/31/2007 2:54 AM Ayaz Hoda
Check web references before making any big changes

# re: DNN and the Lovely "Multiple controls with the same ID" Error 2/13/2008 10:30 AM Amanda
I am having the same problem but specifically in my Dynamic Registration module when trying to compare two fields. If I take out the compare, it works just fine.

Any ideas?
Thanks!

# re: DNN and the Lovely "Multiple controls with the same ID" Error 3/17/2008 10:54 AM Doru
The article is super super great :)

# re: DNN and the Lovely "Multiple controls with the same ID" Error 8/16/2008 11:15 PM B
Got this same error in DNN 4.x after applying a new container. After applying the container, I cant get to any of he pages on my site because I applied it at the host level.

# re: DNN and the Lovely "Multiple controls with the same ID" Error 8/22/2008 12:31 AM Kevin
thanks, this is very useful post. i got stumbled in issue. i have just recovered with this post.

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 1 and 5 and type the answer here: