Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. In a datalist your controls display claiming there are duplicates

In a datalist your controls display claiming there are duplicates

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netwpfalgorithms
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steve_hocking
    wrote on last edited by
    #1

    I'm really sorry for having to ask this, and I have tried searching for the answer but it doesn't seem to be forthcoming. I have an ASP.NET page with a DataList derived control on it. (The control adds some extra javcript, and a few other gubbins, of no particular importance.) The data list has an ItemTemplate and a EditItemTemplate in it, both with a large number of controls. The problem I'm having is that the editor insists that all the controls are duplicates, that there is already a control with that name on the page somewhere. Except I've searched and can't find duplicate id's for any of them. (Okay, I lie slightly, I searched for about twenty randomly picked controls, as there are a *huge* amount of controls in both templates.) To try to resolve this I've swapped the datalist control back to the standard data list, and this didn't have any effect. (I didn't expect it to, as I use the derive DataList on around 30-odd other pages fine.) I also did a massiv renaming exercise, which was interesting. Here's the steps I took: 1) Do a search for id=" replacing with id="temp. 2) Do a search for id= replacing with id=temp 3) Do a search for id=temp"temp replacing with id= I then switched back to HTML mode, went to edit templates, and all of controls were properly drawn, no complaining about duplicates. Has anyone seen this behaviour before, and if so how did you solve it? Thanks, Steve Update After much headscratching I noticed that in the codebehind file for the page all of the erroring controls were declared as protected members, which after checking other pages with DataLists on I determined was incorrect. :doh: So I took all of the incorrect declarations out, and the page can now be editted in the editor! :cool:

    I 1 Reply Last reply
    0
    • S steve_hocking

      I'm really sorry for having to ask this, and I have tried searching for the answer but it doesn't seem to be forthcoming. I have an ASP.NET page with a DataList derived control on it. (The control adds some extra javcript, and a few other gubbins, of no particular importance.) The data list has an ItemTemplate and a EditItemTemplate in it, both with a large number of controls. The problem I'm having is that the editor insists that all the controls are duplicates, that there is already a control with that name on the page somewhere. Except I've searched and can't find duplicate id's for any of them. (Okay, I lie slightly, I searched for about twenty randomly picked controls, as there are a *huge* amount of controls in both templates.) To try to resolve this I've swapped the datalist control back to the standard data list, and this didn't have any effect. (I didn't expect it to, as I use the derive DataList on around 30-odd other pages fine.) I also did a massiv renaming exercise, which was interesting. Here's the steps I took: 1) Do a search for id=" replacing with id="temp. 2) Do a search for id= replacing with id=temp 3) Do a search for id=temp"temp replacing with id= I then switched back to HTML mode, went to edit templates, and all of controls were properly drawn, no complaining about duplicates. Has anyone seen this behaviour before, and if so how did you solve it? Thanks, Steve Update After much headscratching I noticed that in the codebehind file for the page all of the erroring controls were declared as protected members, which after checking other pages with DataLists on I determined was incorrect. :doh: So I took all of the incorrect declarations out, and the page can now be editted in the editor! :cool:

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      I didnt read but it should be e.Item.FindControl(control Name ); 1 line of code equals many bugs. So don't write any!!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups