Solved

Set ASP.NET set checkbox InputAttributes class in markup?

Posted on 2011-03-18
4
1,521 Views
Last Modified: 2012-05-11
I just learned that <asp:checkbox CssClass="xyz"> puts the class tag in a span surrounding the rendered checkbox input element. I can add the class to the input element using server side code such as:

MyCheckbox.InputAttributes("class") = "xyz"

Is it possible to do this somehow directly from the aspx markup?

Thanks in advance.
0
Comment
Question by:ZekeLA
  • 2
4 Comments
 
LVL 51

Expert Comment

by:HainKurt
ID: 35166291
did you try

<asp:checkbox Class="xyz">
0
 
LVL 1

Author Comment

by:ZekeLA
ID: 35166420
class is not a valid attribute of asp:checkbox
0
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 250 total points
ID: 35166444
Hi,

No, you can do that in the Checkbox markup declaration, but you can change your CSS like this


THIS WILL AFFECT THE CHECKBOX
.xyz
{
      background-color: blue;
      }

THIS WILL AFFECT THE DISPLAYED TEXT
.xyz label
{
      background-color: Red;
      }

Hope that helps
0
 
LVL 1

Author Comment

by:ZekeLA
ID: 35166488
I'm using the class for jquery statements so it pretty much has to be on the element itself. Thanks anyway. Knowing it can't be done is a sufficient answer.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question