Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 429733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:48:17+00:00 2026-05-12T19:48:17+00:00

Is there a way to control how .Net sets the Name and ID property

  • 0

Is there a way to control how .Net sets the Name and ID property of my controls? I have some radio buttons for which I need the name to be the same. However if I set the ID property of the radio button control it sets the Name and the ID. I see no way to treat the ID and Name separately. So now all button’s ids are the same as well.

If you are thinking that I should be using a RadioButtonList to achieve this you may be right, but I have not found a way to include table structure in a dynamically created RadioButtonList.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:48:17+00:00Added an answer on May 12, 2026 at 7:48 pm

    Yes.

    Declare a descendant class from, say, a textbox, which overrides the UniqueID and ClientID properties. Then, use (in this example) MyControls.Textbox instead of the built-in textbox.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    
        namespace MyControls
        {
            public class Textbox : System.Web.UI.WebControls.TextBox
            {
                public override string ClientID
                {
                    get
                    {
                        return ID;
                    }
    
                }
    
                public override string UniqueID
                {
                    get
                    {
                        return ID;
                    }
                }
    
            }
    
            public class Button : System.Web.UI.WebControls.Button
            {
    
                public override string ClientID
                {
                    get
                    {
                        return ID;
                    }
    
                }
    
                public override string UniqueID
                {
                    get
                    {
                        return ID;
                    }
                }
            }
        }
    

    Note that you’ll need to register your controls in web.config:

    <pages>
      <controls>
        <add tagPrefix="mycontrols" namespace="MyControls" assembly="MyAssembly" />
      </controls>
    </pages>
    

    Then you can reference them in your markup:

    <mycontrols:TextBox id="myID" runat="server"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to add asp.net server side control dynamically on the webpage
is there a way to bind a asp.net tree view control to a data
On page load is there a way to enumerate all the nest user controls
I have created a VB.NET Class Library that exposes some COM Interop sub routines.
Is there a way in ASP.NET MVC to reference the resource files compiled into
I'm wondering is there any way i could get UserName or UserId for current
I am trying to create a 'log display' using the richtextbox control in C#.NET.
I have 3 questions about using ASP.NET security and Membership in web applications Do
I'm using a Wizard in my ASP.NET page, where in the first step the
When I refresh my website in less than 2-3 minutes, Firebug shows these nice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.