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

How to Set Background Color to RadNumeric Text box

6 Answers 581 Views
Input
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 05 Feb 2013, 03:30 PM
Hi,
I need to set Background Color to RadNumeric Text Box.




Thanks

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Feb 2013, 04:22 AM
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
0
Dhamodharan
Top achievements
Rank 1
answered on 06 Feb 2013, 05:55 AM
Hi,
 Thanks for your reply. how set the Back color to radNumericTextBox through Javascript.
0
Accepted
Princy
Top achievements
Rank 2
answered on 07 Feb 2013, 05:30 AM
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.
0
Dhamodharan
Top achievements
Rank 1
answered on 07 Feb 2013, 10:37 AM
Hi Princy,
Thanks, its Works fine.



Thanks
0
Sheeraz
Top achievements
Rank 1
answered on 24 May 2013, 09:20 AM
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
0
Princy
Top achievements
Rank 2
answered on 24 May 2013, 10:56 AM
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.
Tags
Input
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dhamodharan
Top achievements
Rank 1
Sheeraz
Top achievements
Rank 1
Share this question
or