Alter Textbox Appearance When Value Changed

4 posts, 1 answers
  1. kencox
    kencox avatar
    106 posts
    Member since:
    Oct 2002

    Posted 24 Mar 2010 Link to this post

    I need a visual indicator on the input controls to show unsaved changes.

    Does anyone have an example of altering the background colour, border, or some other part of a control's UI to indicate the user has changed the value since saving?

    Thanks,

    Ken
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Mar 2010 Link to this post

    Hello Ken,

    Try the following approach in order to change the backcolor  after changing the value.

    JavaScript:
     
    <script type="text/javascript"
        var textBox; 
        function OnValueChanged(sender, args) { 
            textBox = sender; 
            setTimeout("textBox._textBoxElement.style.backgroundColor = 'yellow';", 10); 
        } 
    </script> 
    [Attach OnValueChanged event to RadTextBox]

    -Shinu.
  3. kencox
    kencox avatar
    106 posts
    Member since:
    Oct 2002

    Posted 26 Mar 2010 Link to this post

    This is close, but the background colour doesn't stay.

    I need to keep the "changed" appearance until the next save (postback)

    Ken
  4. Answer
    Dimo
    Admin
    Dimo avatar
    8482 posts

    Posted 29 Mar 2010 Link to this post

    Hi Ken,

    In order to change the appearance of a RadInput textbox, so that it is preserved, you should modify the control's styles collection:

    http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

    Apart from EnabledStyle, you can also modify HoveredStyle and FocusedStyle.

    SomeStyle[0] is for inline styles, while SomeStyle[1] is for CSS classes.

    Kind regards,
    Dimo
    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.
Back to Top