Blog Register  |  Login
DNN4 Development Adventures: Multiple controls with the same ID ‘' were found. FindControl requires that controls have unique IDs. Minimize
Location: BlogsDarkware, Inc. Blog    
Posted by: Ricky Vega 12/7/2006 7:49 PM

This was a fun one.  A personal DNN4 website of mine was returning a white web page with only:

 

An error has occurred.
An error has occurred.

 

And a giant red graphic.  How would I go about debugging this given such limited information?  At first, I looked at the URL, I saw the following:

 

http://web.dfwlq.com:6080/portal_v4/Default.aspx?tabid=36&error=Multiple+controls+with+the+same+ID+'Template_386'+were+found.+FindControl+requires+that+controls+have+unique+IDs.&content=0

 

The error looks tucked away on the command line and appearsd to be Multiple controls with the same ID ‘' were found. FindControl requires that controls have unique IDs.  I suspect that a control must be causing this,  but how can I figure out what control it is?  I google

 

“DNN 4 Multiple Controls with the same ID”

 

Google returned a couple of pertinent links:

http://www.dotnetnuke.com/Community/ForumsDotNetNuke/tabid/795/forumid/107/threadid/40728/scope/posts/Default.aspx - This one deals with skins and how they could cause this type of error.  I know we did not mess with skins,  but the interesting part of this is they went into the database and physically changed the skin into something else.  Maybe I can go into the database and change a module definition if I need to.

 

The top selection was http://geekswithblogs.net/flanakin/archive/2005/11/25/61188.aspx

 

Directly from this link:

“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.”

 

It says to find the module and look at the definition.  I don’t want to dig that deep, I just want the site back up, so if that means blowing away the offending module,  then so be it!  However, I need to figure out what is the offending module.   I know that DNN4 has some sort of Log inside it,  but I would have to go into DNN to make the easiest use of it.  If I could not get into the portal using a browser, I could query the DNN table “dbo.EventLog” and figure it out that way.  This problem is made more difficult by the fact that it appears that the offending module is on the first/default page.  The default page URL is:

 

http://<portal url>/Home/tabid/36/Default.aspx

 

Yours may be different.  This is the page that is giving issue.  I was thinking that maybe I could access another page directly (rather than through the portal). Looking through the internet url browser history, I saw:

 

http://<portal url>/Home/tabid/36/ctl/Login/Default.aspx

 

This is the login URL.  I navigate to this page and the page came up. This implies that there error must be caused by a module on the opening page.  I log in with the host uid.  The home/default page comes up under the host uid?  I navigate to the Log Viewer.  The log viewer gives me many errors, the one I am interested in is:

 

AssemblyVersion: 04.03.05
PortalID: 0
PortalName: Dallas/Fort Worth LaserQuest
UserID: -1
UserName:
ActiveTabID: 36
ActiveTabName: Home
RawURL: /portal_v4/Default.aspx
AbsoluteURL: /portal_v4/Default.aspx
AbsoluteURLReferrer:
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: 1e2be149-8be6-420b-91a1-d620202c3fcd
InnerException: Multiple controls with the same ID 'Template_386' were found. FindControl requires that controls have unique IDs.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Web.UI.Control.FillNamedControlsTable
StackTrace:
Message: DotNetNuke.Services.Exceptions.PageLoadException: Multiple controls with the same ID 'Template_386' were found. FindControl requires that controls have unique IDs. ---> System.Web.HttpException: Multiple controls with the same ID 'Template_386' were found. FindControl requires that controls have unique IDs. at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) at System.Web.UI.Control.EnsureNamedControlsTable() at System.Web.UI.Control.FindControl(String id, Int32 pathOffset) at System.Web.UI.Page.FindControl(String id) at DnnForge.NewsArticles.NewsArticleModuleBase.LoadStyleSheet() at DnnForge.NewsArticles.NewsArticles.Page_PreRender(Object sender, EventArgs e) at System.Web.UI.Control.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
Source:
Server Name: DWWEB01

The module is tried to load was : DnnForge.NewsArticles.NewsArticleModuleBase.  Yes! I now have a module!  I go to the home page and remove this module.  Log out.  The application works perfectly now.  YAY!  Either modules are interfering with each other or there is a bug in this code.  I think I will live without this module for the time being.   Indulge!

Permalink |  Trackback

Your name:
Title:
Comment:
Add Comment   Cancel