Changing Css programmatically

7 posts, 0 answers
  1. luc bonenfant
    luc bonenfant avatar
    53 posts
    Member since:
    Sep 2007

    Posted 04 Oct 2010 Link to this post

    Hello,

    I'm using Q3 2009.
    After selecting an item into the combobox, I would like the combobox css takes its highlight skin. This is a fanciful example to understand my request :

    If Not radCombo1.SelectedItem Is Nothing Then
        radCombo1.CssClass = "RadComboBox_Black:hover"
    Else
        radCombo1.CssClass = "RadComboBox_Black"
    End If

    Is it possible to do that please ?
    Thank you.
  2. luc bonenfant
    luc bonenfant avatar
    53 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2010 Link to this post

    Do you understand the question ?
    Have you got a solution please ?

    Thank you.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 07 Oct 2010 Link to this post

    Hello luc bonenfant,

    As I understand from your explanations – you use the “Black” RadComboBox Skin and you want the text at the control input to be colored in green after user selects an item (as it is when the control input is hovered) .

    Let me suggest you change the RadComboBox input text color at client-side handling the OnClientSelectedIndexChanged event:
    <script type="text/javascript">
     
        function OnClientSelectedIndexChangedHandler(sender, eventArgs) {
            if (sender.get_selectedItem() != null) {
                var inputElement = sender.get_inputDomElement();
                inputElement.style.color = "#9eda29";
            }
     
        }
    </script>
     
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Black"
        OnClientSelectedIndexChanged="OnClientSelectedIndexChangedHandler" >
        <Items>
            <telerik:RadComboBoxItem runat="server" Text="ALL" Value="ALL" />
            <telerik:RadComboBoxItem runat="server" Text="A" Value="A" />
            <telerik:RadComboBoxItem runat="server" Text="B" Value="B" />
            <telerik:RadComboBoxItem runat="server" Text="C" Value="C" />
        </Items>
    </telerik:RadComboBox>

    I hope this helps.

    Greetings,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. luc bonenfant
    luc bonenfant avatar
    53 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2010 Link to this post

    I'm sorry, that's not exactly what i need.

    If we use Forest skin rather than Black, it's better in fact :
    When you highlight the combobox, you can see a light green background instead of the white background. I would like to active this background definitively if one item is selected. So I need to change the css active by the css hover if selection is done.
    It can be done from code behind because i make a postback for each combo selected.

    Why that ?: i'm using 20 filters filtered with combos. I would like to visually differenciate the selected combos from others.

    Thanks.
    Luc
  6. luc bonenfant
    luc bonenfant avatar
    53 posts
    Member since:
    Sep 2007

    Posted 11 Oct 2010 Link to this post

    Any Suggestion please ?
  7. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Oct 2010 Link to this post

    So you just want a way to visually mark a combo as complete?

    Why not handle the clientside SelectedIndexChanged event as Kalina suggested.

    Then use jQuery to set a "complete" class on the combobox itself (like "RadComboCompleted").  Then the you would just style that element to have something like this
    .RadComboCompleted td.rcbInputCellLeft {
        background-position: 0 -176px !important;
    }

    Then any completed combo gets that style, and CSS handles how it looks.
  8. luc bonenfant
    luc bonenfant avatar
    53 posts
    Member since:
    Sep 2007

    Posted 12 Oct 2010 Link to this post

    Thanks for help, finally the first solution was marvelous !
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017