Solved

Set ASP.NET set checkbox InputAttributes class in markup?

Posted on 2011-03-18
4
1,541 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

807 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