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

Watermark?

8 Answers 341 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 02 Aug 2011, 08:16 PM
How can I do a watermark in a textbox on winforms?

Thanks,
David

8 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 05 Aug 2011, 06:57 AM
Hi David,

Thank you for writing.

If I understand watermark correctly, you refer to the text that is displayed within the RadTextBox when the user has not typed in anything and which disappears once the text box gets focused. If this is the case than you can use the NullText property of the RadTextBox for this purpose. If this is not what you are looking for, I would kindly ask you to provide some more detailed information on what you want.

I hope this will help. If you have further questions, I would be glad to help.

Greetings,
Ivan Petrov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Joakim Linnarsson
Top achievements
Rank 1
answered on 31 Oct 2012, 05:39 AM
Hello,

In my appliccation i use radAutoCompleteBox and i want to apply watermark on it....How to do it?

0
Ivan Petrov
Telerik team
answered on 02 Nov 2012, 02:36 PM
Hello Joakim,

Thank you for writing.

If you refer to the text displayed in RadAutoCompleteBox when there is no user input then the property is the same is in my previous post - NullText. When the controls has no text entered by the user and it is not focused the text in the NullText property will be displayed.

I hope this will be useful. Should you have further questions, I would be glad to help.
 
All the best,
Ivan Petrov
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Chan
Top achievements
Rank 1
answered on 29 Mar 2013, 05:41 AM
Helo !!!

I used RadTextBoxControl control to search records (Text box to search records with autocomplete feature - winforms, C#).

Now, i want my autocomplete to be similar as of google search box works.
like, the moment i started typing text in the textboxcontrol the first matching record should appear as watermark, instead of highlighted and selected.This autocomplete records being pulled from database.

While typing the text in radtextboxcontrol, the matching characters should be highlighted with bold fonts and the rest characters from matching records should be watermarked.
For illustration of my problem you may have look on google search textbox.

Looking ahead for your response.

Thanks,
Arpus
0
Ivan Petrov
Telerik team
answered on 02 Apr 2013, 05:42 AM
Hello Arpus,

Your question is not related to the initial question of this thread - see p4 from our forum rules. Please avoid mixing different subjects in the same thread as this makes it harder for the users to find the information they are looking for. If you cannot find a suitable thread, feel free to open a new one.
All the best,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Alexander
Top achievements
Rank 1
answered on 09 Dec 2015, 01:54 PM

Hi,

 I want to display the NullText until the user type something into the textbox. Is this possible?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Dec 2015, 03:03 PM
Hello Alexander,

Thank you for writing.

l text is supported out of the box in our control and it is visible when the text box has no text and no focus. Once it gets focus, the null text gets hidden. You can use it by setting the NullText property.

If you want to show the null text until the user starts typing you will have to subscribe to the TextBoxElement.TextBoxItem.TextBoxControl.GotFocus and set via Reflection the allowPrompt field of the HostedTextBoxBase to true:
public Form1()
{
    InitializeComponent();
      
    this.radTextBox1.NullText = "Enter some value";
    this.radTextBox1.TextBoxElement.TextBoxItem.TextBoxControl.GotFocus += radTextBox1_GotFocus;
}
 
private void radTextBox1_GotFocus(object sender, EventArgs e)
{
    FieldInfo fi = typeof(HostedTextBoxBase).GetField("allowPrompt", BindingFlags.NonPublic | BindingFlags.Instance);
    fi.SetValue(this.radTextBox1.TextBoxElement.TextBoxItem.TextBoxControl, true);
}

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik

0
Alexander
Top achievements
Rank 1
answered on 10 Dec 2015, 07:09 AM
Perfect, thank you!
Tags
TextBox
Asked by
David
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Joakim Linnarsson
Top achievements
Rank 1
Chan
Top achievements
Rank 1
Alexander
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or