Watermark?

9 posts, 0 answers
  1. David
    David avatar
    8 posts
    Member since:
    May 2008

    Posted 02 Aug 2011 Link to this post

    How can I do a watermark in a textbox on winforms?

    Thanks,
    David
  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 05 Aug 2011 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Joakim Linnarsson
    Joakim Linnarsson avatar
    10 posts
    Member since:
    Nov 2009

    Posted 31 Oct 2012 Link to this post

    Hello,

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

  5. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 02 Nov 2012 Link to this post

    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.
  6. Chan
    Chan avatar
    14 posts
    Member since:
    Nov 2012

    Posted 29 Mar 2013 Link to this post

    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
  7. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 02 Apr 2013 Link to this post

    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.
  8. Alexander
    Alexander avatar
    19 posts
    Member since:
    Aug 2014

    Posted 09 Dec 2015 Link to this post

    Hi,

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

  9. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 09 Dec 2015 Link to this post

    Hello Alexander,

    Thank you for writing.

    Null 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

  10. Alexander
    Alexander avatar
    19 posts
    Member since:
    Aug 2014

    Posted 10 Dec 2015 in reply to Dess Link to this post

    Perfect, thank you!
Back to Top
UI for WinForms is Visual Studio 2017 Ready