Solved

Set ASP.NET set checkbox InputAttributes class in markup?

Posted on 2011-03-18
4
1,558 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Huseyin KAHRAMAN
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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