Set the font color in Rad Numeric Textbox in Code-behind

3 posts, 1 answers
  1. Dave
    Dave avatar
    13 posts
    Member since:
    May 2012

    Posted 14 Jan 2014 Link to this post

    What is the correct way to set the font color of a RAD Numeric textbox in the code-behind? I have a CSS Class set up and tried the .WrapperCssClass attrubute but the color did not change. I would like to change the color to red if the value is negative.

    Thanks,
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Jan 2014 Link to this post

    Hi Dave,

    Please have a look into the following C# code snippet to change the font color of RadNumericTextBox.

    C#:
    protected void RadNumericTextBox1_TextChanged(object sender, EventArgs e)
    {
        if (Convert.ToInt16(RadNumericTextBox1.Text)<0)
        {
            RadNumericTextBox1.Style.Add("color ", "Red");
        }
    }

    Thanks,
    Shinu.
  3. Dave
    Dave avatar
    13 posts
    Member since:
    May 2012

    Posted 14 Jan 2014 Link to this post

    Yes, perfect. Thank you.
Back to Top