textbox value is cleared on focus

2 posts, 1 answers
  1. Sander Notenbomer
    Sander Notenbomer avatar
    5 posts
    Member since:
    May 2009

    Posted 16 Aug 2010 Link to this post

    I have a textbox whixh is defined like below.

    <telerik:RadTextBox ID="rtbUserName" runat="server" Width="98%" ShouldResetWidthInPixels="false">
    </telerik:RadTextBox>

    And when i want to set it's value by using jquery. See the following code line.
    $('input[id$=rtbUserName_text]').val("Test");

    The value is correctly set in the textbox. But when i enter the textbox to change the value. The whole value disappears.

    Can someone please tell me if it's possible what i want. Because i don't want to work with client id's.
  2. Answer
    Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 16 Aug 2010 Link to this post

    Hi Sander,

    Generally, this is an incorrect way to set the RadTextBox value, but if you insist on using it, then please add the following line:

    $('input[id$=rtbUserName_text]').val("Test");
    $('input[id$=rtbUserName]').val("Test");

    Normally, the RadTextBox value should be set via the control's client API:

    http://www.telerik.com/help/aspnet-ajax/input_clientsideradtextbox.html

    http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html


    Regards,
    Dimo
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top