如何在radiobuttonlist中获得一个单选按钮,以便在selectedindex更改时更改其颜色? [英] How do i get one radio button in a radiobuttonlist to change its color at selectedindex changed?

查看:171
本文介绍了如何在radiobuttonlist中获得一个单选按钮,以便在selectedindex更改时更改其颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个radiobuttonlist控件,我在下面有这个事件:

I have a radiobuttonlist control and and i have this event below:

Protected Sub LinkButtonShowAns_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButtonShowAns.Click
        ctr = Session("ctr")
        dt = Session("Answered")
        Me.RadioButtonList1.SelectedIndex = dt.Rows(ctr).Item("correct") - 1

        Session("ctr") = ctr
    End Sub





导致选择radiobuttonlist中的一个单选按钮。



我现在想要做的只是制作所选单选按钮的颜色在radiobuttonlist中更改。请非常感谢任何想法,链接和代码帮助。



which causes one of the radio buttons in the radiobuttonlist to be selected.

All i want to do now is to also make only the colour of the selected radio button to change in the radiobuttonlist. Please any ideas, links and code help would be greatly appreciated.

推荐答案

请参阅我最近关于如何处理事件的答案:ASP.NET MVC4应用程序 [ ^ ]。



用于从活动中更改演示文稿的颜色和其他方面处理程序,更喜欢使用CSS组方法: http://api.jquery.com/category/css/ [< a href =http://api.jquery.com/category/css/target =_ blanktitle =New Window> ^ ]。



-SA
Please see my recent answer on how to handle the event: ASP.NET MVC4 Application[^].

For changing color and other aspects of the presentation from an event handler, prefer using CSS group of methods: http://api.jquery.com/category/css/[^].

—SA


我只想做以下几行代码:



Me.RadioButtonList1.SelectedItem.Attributes.Add(style,color:red)



它改变了pa radiobuttonlist1中的rticular单选按钮为红色。我这样做是因为它完美无缺。
All i wanted to do, needed just this line of code below:

Me.RadioButtonList1.SelectedItem.Attributes.Add("style", "color: red")

It changes the particular radio button in the radiobuttonlist1 to red. I settled for this because it works just perfectly.


这篇关于如何在radiobuttonlist中获得一个单选按钮,以便在selectedindex更改时更改其颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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