Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a radiobuttonlist control and and i have this event below:
VB
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


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.
Posted
Comments
Do u want to change the color of circle or the text ?
OsoJames 13-May-13 11:02am    
a code on doing both will be superb

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
 
Share this answer
 
Comments
OsoJames 13-May-13 11:07am    
Please Sergey, i have a very short time to work around this, learning jquery now might be good but not greatly helpful, so if you could give me a simple vb code to go about this i would be most grateful.
Sergey Alexandrovich Kryukov 13-May-13 11:24am    
You should better try it by yourself and ask questions if you face any problems.
—SA
OsoJames 13-May-13 14:29pm    
Sorry, its not like i want you to do my homework for me but i've been trying some codes and ain't working and i need urgent help. The code below is one of them:

RadioButton1.InputAttributes.Add("onmouseover", _
"this.style.backgroundColor = 'red'")
RadioButton1.InputAttributes.Add("onmouseout", _
"this.style.backgroundColor = 'white'")

:)
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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900