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

change background

1 Answer 12 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dawson
Top achievements
Rank 1
Dawson asked on 18 Jun 2014, 11:59 AM
Hi,
I have a scenario.. How can i change the background color of a radcombox with change in selected item from client side.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2014, 12:10 PM
Hi Dawson,

Try the following code to achieve your scenario.

ASPX:

<telerik:RadComboBox runat="server" id="RadComboBox1" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" >
         <Items>
                <telerik:RadComboBoxItem Text="red" Value="red" />
                <telerik:RadComboBoxItem Text="blue" Value="blue" />
                <telerik:RadComboBoxItem Text="green" Value="green" />
                <telerik:RadComboBoxItem Text="yellow" Value="yellow" />
         </Items>
</telerik:RadComboBox>

Javascript:

function OnClientSelectedIndexChanged(sender, args)
        {
            sender.get_inputDomElement().style.backgroundColor = args.get_item().get_value();
        }

Thanks,
Shinu
Tags
General Discussions
Asked by
Dawson
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or