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. Override name generator ?

Override name generator ?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestioncsharpasp-nethelp
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.
  • T Offline
    T Offline
    Tee
    wrote on last edited by
    #1

    How to override the controls's name generator? I have to create a UserControl that is so similiar as the ASP.NET radiobutton, and also I have to use GroupName in order to group the controls. But there is a problem. Because the userControl is inherited from INamingContainer, and because of that even i set the same GroupName for all my UserControls, the Name property of userControls of the groups are all still different. For example And also, i can't set all the usercontrols have to same ID. So how can i solve this problem ?

    M 1 Reply Last reply
    0
    • T Tee

      How to override the controls's name generator? I have to create a UserControl that is so similiar as the ASP.NET radiobutton, and also I have to use GroupName in order to group the controls. But there is a problem. Because the userControl is inherited from INamingContainer, and because of that even i set the same GroupName for all my UserControls, the Name property of userControls of the groups are all still different. For example And also, i can't set all the usercontrols have to same ID. So how can i solve this problem ?

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, Because your control implements the the INamingContainer interface, so all the child controls are guaranteed that they have unique names and also naming conflicts are avoided on a page. For example, you happen to put another radio button control on the page with the name "RepairType", so there is a naming conflict between this radio button and the one in your control if it does not implement the INamingContainer. For more information, you can se INamingContainer [^] interface. In this case, you can use the html radio markup <input type='radio' name='RepairType'> instead of the radiobutton control to make sure that at the client side they all have the same name, and at the server side you can retrieve the value of the radio button using the Requets.Form.

      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