Multiple controls with the same ID

Last post 08-25-2005 4:10 PM by pmgerholdt. 8 replies.

Sort Posts:

  • Multiple controls with the same ID

    08-18-2005, 4:11 PM
    • Participant
      1,235 point Participant
    • pmgerholdt
    • Member since 08-07-2002, 3:36 PM
    • fredonia ny usa
    • Posts 247
    I am getting a module (first 'real' module since 2.1.2) into production and have broken it into three module interfaces in the .dnn file, so when you pull it onto the page, three modules/containers appear. Each will have their own controls but display related information.

    Before I split them up, all worked fine - but for purposes of being able to display in different panes I was asked if it could get split. (After the project was complete, of course.)

    It all compiles fine and installs fine, and pulls onto the page in three pieces. However, I get this error:

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

    I figure that this is because behind the scenes each of these three instances uses some of the same stuff - I have a different INFO class for each one, plus a third INFO class that they all use, but one controller class. I use same naming conventions everywhere.

    How would I find out what to name differently so the controls in the aspx page don't have the same name and so step on each other?

    Thanks!
    Michael Gerholdt
  • Re: Multiple controls with the same ID

    08-21-2005, 11:19 AM
    • Participant
      1,570 point Participant
    • mm53bar
    • Member since 03-03-2003, 7:20 PM
    • Edmonton, Canada
    • Posts 314
    Michael,

    This isn't a fix, but I've found this error quite a few times whenever I have migrated a site.  Usually, it seems to occur when the portal is trying to load a module but the module code isn't there.  Quite often when I migrate, I move the db but forget to move some of the custom modules that I use.  That means that the db is telling the portal to load the module, but the ascx files don't exist.

    Are there any other modules on the same tab as your custom module?  If so, do they physically exist in the DesktopModules folder?

    Other than this, the only suggestion that I have is to search the forums.

    Good luck.

    mike.

  • Re: Multiple controls with the same ID

    08-22-2005, 8:02 AM
    • Contributor
      3,432 point Contributor
    • matchbx27
    • Member since 03-12-2003, 8:40 AM
    • Posts 699

    When you setup your module definitions it looks like you created 1 module definition with three view controls.  A module can have multiple view controls but each must be created under a different module definition.

     

    Think of it this way..  Each module definition creates a line item in the module dropdown box on on the admin panel.  A module definition can have many controls (but only one view control).  So you can create three definitions each defintion would have one view control as well as the edit controls associated with that view control.

     

    Hope this helps.

    matchbx
  • Re: Multiple controls with the same ID

    08-22-2005, 9:39 AM
    • Participant
      1,235 point Participant
    • pmgerholdt
    • Member since 08-07-2002, 3:36 PM
    • fredonia ny usa
    • Posts 247
    Thanks for your responses. My need was to have three view spaces, each with their own edit control. It started as one module but then the request was to break the display out.

    When I pulled the module onto the page three modules, each with separate moduleID, were created. But if each had a blank 'view' control then DNN would create three controls with the same name at the time I pulled them onto the page; hence the problem. If I gave each of them a different key (blank for one, named distinctly for the other two) then there was no problem. However, the two with actual names instead of blank for the key did not get displayed - even though they were of view 'type.'

    I wonder about this. If the type is set to view, then the key should be able to have a name, and behavior should be based on type rather than absence of a key. At least that's how it seems to this beginning module developer. Seems like it would provide more flexibiliity. But like I said, just starting out here.

    I was given a suggestion of naming the controls programmatically but couldn't quite figure that out.

    In the end, I created three separate modules entirely. All use the same namespace and so the functionality didn't have to be replicated. This is working.

    Thanks again -
  • Re: Multiple controls with the same ID

    08-22-2005, 10:23 AM
    • Contributor
      3,432 point Contributor
    • matchbx27
    • Member since 03-12-2003, 8:40 AM
    • Posts 699
    Just so that you are aware, you don't have to create three different modules, but only one module with 3 definitions.  Each definition would have one or more controls.
    matchbx
  • Re: Multiple controls with the same ID

    08-22-2005, 10:30 AM
    • Participant
      1,235 point Participant
    • pmgerholdt
    • Member since 08-07-2002, 3:36 PM
    • fredonia ny usa
    • Posts 247

    I believe that is just what I was doing; in the .dnn file

    <modules>

    <module>

     <stuff about the first modules including controls>

    </module>

    <module>

    <stuff about the second module including controls>

    </module>

    </modules>

    If this is what you are suggesting, then this is what I was doing. Leaving the key blank for all three resulted in the error. Leaving one blank and using unique names for the other two module definitions for the view type made the two with keys for the view control not appear.

     

  • Re: Multiple controls with the same ID

    08-22-2005, 11:47 AM
    • Contributor
      3,432 point Contributor
    • matchbx27
    • Member since 03-12-2003, 8:40 AM
    • Posts 699
    lol  sometimes it pays to be on the same page. 

    It's been a long time since I looked at a .dnn file.  I am currently in the middle of developing and I'm using the Module Definitions found under the Host menu to add the module definitions manually.  It will be a while before I start creating the .dnn file.
    matchbx
  • Re: Multiple controls with the same ID

    08-22-2005, 9:28 PM
    • Participant
      1,084 point Participant
    • mcsenow
    • Member since 05-24-2003, 7:29 PM
    • McLean, VA
    • Posts 218
     pmgerholdt wrote:
    Thanks for your responses. My need was to have three view spaces, each with their own edit control. It started as one module but then the request was to break the display out.

    When I pulled the module onto the page three modules, each with separate moduleID, were created. But if each had a blank 'view' control then DNN would create three controls with the same name at the time I pulled them onto the page; hence the problem. If I gave each of them a different key (blank for one, named distinctly for the other two) then there was no problem. However, the two with actual names instead of blank for the key did not get displayed - even though they were of view 'type.'

    Thanks again -


    I wonder this article migh help you http://opensource.indyneinc.com/home/DevX/Articles/DynamicLoadUserControlsinDotNetNuke3/tabid/67/Default.aspx.  It is a techniqe for load user control into DNN View or Edit control.

    Regards
  • Re: Multiple controls with the same ID

    08-25-2005, 4:10 PM
    • Participant
      1,235 point Participant
    • pmgerholdt
    • Member since 08-07-2002, 3:36 PM
    • fredonia ny usa
    • Posts 247
    Thanks for this link, Fuji. It will be helpful.
Page 1 of 1 (9 items)