更改禁用的单选按钮列表元素的颜色 [英] Change color of disabled radiobutton list element

查看:1441
本文介绍了更改禁用的单选按钮列表元素的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个radiobuttonlist有一堆列表项,其中一些被禁用。
单选按钮旁边的标签控件变为灰色,这很难阅读。
如何更改标签的颜色?
我试过CSS,改变forecolor - 没有什么似乎工作:

I've got a radiobuttonlist with a bunch of list items, some of them disabled. The label control beside the radio button turns gray, which can be hard to read. How do I change the color of the label? I've tried CSS, changing the forecolor - nothing seems to work:

currentButton.Attributes.Add("class", "disabled");

任何想法?

推荐答案

虽然我从来没有使用asp.net内置的控件,我在这里猜测你的RadioButtonList试图足够聪明,并渲染一些CSS(内联或类/ id)来直观反映它控制状态。

Although I've never used asp.net built-in controls, I'm guessing here that your RadioButtonList is trying to be smart enough and renders some CSS (inline or class/id) to visually reflect its control state.

您应该看看生成的HTML,并找到这样的CSS代码,然后尝试覆盖它。如果他们设计控制我的想法,也许有一个属性,让你改变特定的状态颜色。但是如果没有这样的属性,你总是可以选择使用你的自定义CSS覆盖它。

You should take a look at the generated HTML and spot such CSS code then try to override it. If they designed that control the way I think, maybe there's a property that lets you change that particular state color. But if there isn't such a property, you always have the option to override that with your custom CSS.

如果CSS被渲染为inline )回到这里,我会尽量回来一个解决方法。

If the CSS is rendered inline (blame MS for that LOL) post back here and I'll try to get back with a workaround.

这篇关于更改禁用的单选按钮列表元素的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆