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

change forecolor dynamically

4 Answers 158 Views
Input
This is a migrated thread and some comments may be shown as answers.
Bharani Mani
Top achievements
Rank 1
Bharani Mani asked on 24 Dec 2009, 07:57 PM
Hello,
        Wish you all merry christmas and a happy new year.  I want to change the color of the text in a RadTextBox control dynamically OnMouseOut. I want to do it on Client-Side. I checked the Input styles properties. and I didnt see any method to set the style of input. I saw get_style() but not set_style, not sure how to do it..


Thanks,
Bharani

4 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 27 Dec 2009, 07:53 PM
You should be able to get it done with some quick jQuery

http://docs.jquery.com/CSS/css#namevalue

    $telerik.$("#'<%=myTextBox.ClientID %>'").mouseover(function () {
      $telerik.$(this).css("color","red");
    });

Here's the events you can use
http://docs.jquery.com/Events

jQuery comes embedded into most of the telerik components, just make sure to use $telerik.$ instead of just $.

Give it a try, you can do some awesome stuff with jQuery, and like I said, it comes built into the Telerik.Web.UI anyway!

Steve
0
Princy
Top achievements
Rank 2
answered on 28 Dec 2009, 08:21 AM
Hello Bharani,

You can set styles for the datepicker as shown below:
js:
function MouseOut(sender,args) 
    { 
       sender.get_styles().EnabledStyle[0] += "background-color: lightblue;"
       sender.updateCssClass(); 
    } 

Check out the section 'Changing the appearance style of RadInput controls on the client' of the following document for more information:
Client-Side Basics

Thanks
Princy.
0
Bharani Mani
Top achievements
Rank 1
answered on 28 Dec 2009, 04:02 PM
Hello Princy,
         I did try your way of setting the forecolor of the textbox but didnt work.

            sender.get_styles().EnabledStyle[0] += "ForeColor: red";
            sender.updateCssClass();



     
Am I doing anything wrong?

Thanks,
Bharani
0
Dimo
Telerik team
answered on 28 Dec 2009, 04:09 PM
Hi Bharani Mani,

ForeColor is a server-side ASP.NET property. The corresponding CSS property is color.

Please make yourself familiar with the CSS properties at

http://www.w3.org/TR/CSS21/propidx.html

Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Bharani Mani
Top achievements
Rank 1
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Princy
Top achievements
Rank 2
Bharani Mani
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or