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 4106552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:23:29+00:00 2026-05-20T21:23:29+00:00

In ASP.NET, you can add custom HTML tag attributes to a UserControl via myLabel.Attributes[‘my-custom-attribute’]

  • 0

In ASP.NET, you can add custom HTML tag attributes to a UserControl via

myLabel.Attributes['my-custom-attribute'] = "someValue";
// or Attributes.Add()

… but how can I add an attribute that doesn’t have a value? For example, (and I’m not saying that this is what I need) the W3C specification only needs the checked attribute present in a checkbox to consider it checked (instead of checked='true' or something).

<span ID="ctl-blah-blah-myLabel" my-custom-attribute>some text</span>

I’m looking into using something like this to tag specific elements on my page for some client-side behavior. I know that I can do the same with classes, but (1) classes are iffy to manipulate server-side, and (2) I kind of don’t want to pollute my class declarations just for tagging (that may be weird for some, I know).

  • 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-20T21:23:29+00:00Added an answer on May 20, 2026 at 9:23 pm

    I don’t think you can, doing what you’re asking is not a well-formed document. The W3C specification you are looking at is old, as far as the checked attribute is concerned. Proper form, now-a-days, is to put checked=”checked”.

    While many browsers might accept this, I wouldn’t recommend that you do it. What is it that you’re trying to accomplish? Maybe there’s a better solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can I add BehaviorID attribute for asp.net textbox and use it to be recognize
How can I add a string property to my ASP.NET custom control that will
Can I add an event handler to a session value in asp.net with c#?
When sending email using the SMTPClient class in ASP.NET C#, how can I add
In asp.net mvc, you can easily call/add a controller from a view, but what
Can I adjust the ASP.NET Membership Tables to add some columns of my own?
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
I want to add custom columns to some tables created by ASP.NET. For example;
In ASP.NET, if you have an HTTP Module or something similar, you can add
There are two ways of creating a custom HTML helper in ASP.NET MVC: You

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.