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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:42:05+00:00 2026-05-23T23:42:05+00:00

I am working on a web forms page which has a GridView which contains

  • 0

I am working on a web forms page which has a GridView which contains two columns of radio buttons generated from an asp:RadioButton control.

I wanted to implement a “select all” checkbox in the respective column headers that would when checked select all of the corresponding radio buttons to checked in that particular column.

I wrote a small bit of jQuery which would do this but it didn’t work straight away. In order for jQuery to select each radio button and mark it as checked I set the class name of the asp:RadioButton control using the CssClass attribute:

<asp:RadioButton ID="id" CssClass="myClass" runat="server" ... />

I was expecting this to generate markup something like:

<input type="radio" class="myClass" ... />

Meaning my jQuery selector would be:

jQuery("input.myClass")

Instead it has wrapped the input element in a span element and applied the class attribute I specified to the span element instead of the input element.

Is there a way to prevent ASP.NET generating this wrapping span element around my input element when using the asp:RadioButton control?

Can I get it to apply the class attribute to the actual input element, instead of the wrapping span element if ASP.NET has to generate it?

(Note: I have updated my jQuery to use a selector that works in the meantime:

jQuery("span.myClass input")

)

  • 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-23T23:42:05+00:00Added an answer on May 23, 2026 at 11:42 pm

    Web controls in the System.Web.UI.WebControls namespace may render differently in different browsers. You can’t count on them rendering the same elements always. They may add anything that they think is needed to make it work in the specific browser, changing with each version of .NET.

    If you want to have any control over how the controls are rendered as html, you should use the controls in the System.Web.UI.HtmlControls namespace instead. That is:

    <input type="radio" id="RadioButton1" runat="server" class="myClass" />
    <input type="radio" id="RadioButton2" runat="server" class="myClass" />
    <input type="radio" id="RadioButton3" runat="server" class="myClass" />
    

    They will render just as the corresponding html element, with no extra elements added. This of course means that you will have to take responsibility for the browser compatibility, as the control doesn’t. Also, those controls doesn’t have all the features of the controls in the WebControls namespace. So it depends on your needs for the specific situation.

    You could also find another means of selecting all of the inputs in jquery, like basing it on the id (using a similar name on all of them, and a wildcard to select them all). Attribute Contains Selector

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

Sidebar

Related Questions

I am working on a ASP.Net web forms application which I inherited from a
I am working on a ASP.NET MVC web site that has multiple submit buttons.
I am working on an ASP.NET 4.0 web forms project that uses page routing
I have a discussion forum/blog engine working with web forms. Each post contains html
I've been working a lot with asp.net web forms and one think that I
I've started working on some enhancements to an ASP.NET web forms e-commerce project, one
I have a usercontrol in an asp web forms application that I am working
I'm working on a web application. One of my co-workers has written some asp.net
I have a JSF/Seam web app which has a page with a form which,
I create an asp.net 4.0 web application which has a web service for uploading

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.