How to Set Background Color to RadNumeric Text box

7 posts, 1 answers
  1. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 05 Feb 2013 Link to this post

    Hi,
    I need to set Background Color to RadNumeric Text Box.




    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Feb 2013 Link to this post

    Hi Dhamodharan

    Trying the following markup to set background color to RadNumeric TextBox
    aspx:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server">
       <EnabledStyle BackColor="Red" />
    </telerik:RadNumericTextBox>

    Thanks
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 05 Feb 2013 Link to this post

    Hi,
     Thanks for your reply. how set the Back color to radNumericTextBox through Javascript.
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Feb 2013 Link to this post

    Hi dhamodharan,

    Try the following markup and Javascript to change the background color.

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox" runat="server">
        <ClientEvents OnLoad="Load" />
    </telerik:RadNumericTextBox>

    JS:
    <script type="text/javascript">
    function Load(sender, args) {
        sender.get_styles().EnabledStyle[0] += "background-color: Blue";
        sender.get_styles().HoveredStyle[0] += "background-color: Blue";
        sender.get_styles().FocusedStyle[0] += "background-color: Blue";
        sender.updateCssClass();
    }
    </script>

    Thanks,
    Princy.
  6. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 07 Feb 2013 Link to this post

    Hi Princy,
    Thanks, its Works fine.



    Thanks
  7. Sheeraz
    Sheeraz avatar
    27 posts
    Member since:
    Nov 2012

    Posted 24 May 2013 Link to this post

    Hi Princy,

    I tried to run your code its working on control load but I want conditional formatting onvaluechanged event or radnumerictextbox.
    I have tried to use this code in this event its work for first time entry for any other change it does not work. Please help me out with any running example.

    Regards
    Sheeraz Raza
  8. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 May 2013 Link to this post

    Hi,

    Try the following to achieve the same in onvaluechanged event.

    JS:
    function OnValueChanged(sender, args)
     {
            sender.get_styles().EnabledStyle[0] = sender.get_styles().EnabledStyle[0].replace("background-color: Red;", "")
            sender.get_styles().HoveredStyle[0] = sender.get_styles().HoveredStyle[0].replace("background-color: Red;", "")
            sender.get_styles().FocusedStyle[0] = sender.get_styles().FocusedStyle[0].replace("background-color: Red;", "")
     
            sender.get_styles().EnabledStyle[0] += "background-color: Red;";
            sender.get_styles().HoveredStyle[0] += "background-color: Red;";
            sender.get_styles().FocusedStyle[0] += "background-color: Red;";
            sender.updateCssClass();
     }

    Thanks,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017