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

Restyle RadComboBox if it fails custom validation?

2 Answers 59 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 2
James asked on 23 Jul 2009, 05:11 PM
Is it possible to restyle a radcomboxbox if it doesn't pass custom validators? Ideally we wanted to put a red border around the outside of the combobox. We have managed to do this with a radtextbox but the combobox is proving to be a little bit tricker? Any suggestions? 

2 Answers, 1 is accepted

Sort by
0
Accepted
Paul
Telerik team
answered on 24 Jul 2009, 09:17 AM
Hi James,

Please find below a sample code snippet that shows the needed approach.

<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
    <style type="text/css"
        .redBorder 
        { 
            border: solid 1px red; 
        } 
    </style> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
 
    <script type="text/javascript"
        function test() { 
            var combo = $find('<%= RadComboBox1.ClientID %>'); 
            combo.addCssClass("redBorder"); 
        } 
    </script> 
 
    <telerik:RadComboBox ID="RadComboBox1" runat="server"
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" /> 
        </Items> 
    </telerik:RadComboBox> 
    <input id="Button1" type="button" value="button" onclick="test()" /> 
    </form> 
</body> 
</html> 


All the best,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
James
Top achievements
Rank 2
answered on 27 Jul 2009, 09:44 AM
Thanks Paul - that worked great.
Tags
ComboBox
Asked by
James
Top achievements
Rank 2
Answers by
Paul
Telerik team
James
Top achievements
Rank 2
Share this question
or