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

RadTextBox Null Text Style

1 Answer 84 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 06 Jul 2014, 04:24 PM
Is it at all possible to change the style of the RadTextBox when there is no text value - i.e Null Text?

I am used to the Infragistics controls and there is a nice and easy appearance for this.

Thanks

Andez

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Jul 2014, 02:30 PM
Hello Andez,

Thank you for writing.

Yes you can style the null text. For example you can change its color as follows:
radTextBox1.TextBoxElement.TextBoxItem.NullTextColor = Color.Red;

Additionally you can use the GotFocus and LostFocus events to change other styles:
void radTextBox1_GotFocus(object sender, EventArgs e)
{
    if (radTextBox1.Text == null || radTextBox1.Text == string.Empty)
    {
        this.radTextBox1.TextBoxElement.BackColor = Color.White;
    }
}
 
void radTextBox1_LostFocus(object sender, EventArgs e)
{
    if (radTextBox1.Text == null || radTextBox1.Text == string.Empty)
    {
        this.radTextBox1.TextBoxElement.BackColor = Color.LightGray;
    }
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
TextBox
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or