This is a migrated thread and some comments may be shown as answers.

[Solved] Hovered class on RCB when item is selected?

2 Answers 120 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 05 May 2009, 12:10 AM
When the RadComboBox is hovered the class "rcbHovered" is applied to the table tag.

I've a situation where I'd like to have the RCB to appear hovered when an item is selected.

How would I do this when the RCB is Selected/Posts back??

I know I can override the skin styles but would rather do the above.. if can be.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 May 2009, 06:39 AM
Hello David,

From what i understand, i suppose you are trying to set a color for a combobox item when its selected. If thats the case then you can try out the following  code:
c#:
 protected void comCity_PreRender(object sender, EventArgs e) 
    { 
        foreach (RadComboBoxItem item in comCity.Items) 
        { 
            if (item.Selected) 
            { 
                item.BackColor = System.Drawing.Color.FromName("#4c4c4c"); 
            } 
            else 
            { 
                item.BackColor = System.Drawing.Color.Empty; 
            } 
        } 
    } 
If this does not help, explain a bit more of what you are trying to achieve.

Thanks
Princy.
0
David
Top achievements
Rank 1
answered on 05 May 2009, 01:33 PM

Thanks for your reply.

The selected item appears selected, as expected.
I am looking into how I can force the input and drop arrow to 'appear selected', as it is when it's hovered.

Inspecting the rendered html.. the table has no class in normal state.  When hovered it gets the class 'rcbHovered'..
I want to apply that rcbHovered class to the table when it's in normal state.  (programatically, when an item is selected)

It would be great if the RCB had a property to optionally toggle this.

Thanks again.
David

Tags
ComboBox
Asked by
David
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
David
Top achievements
Rank 1
Share this question
or