Reset RadTextBox value to default on client

2 posts, 0 answers
  1. Craig Wallace
    Craig Wallace avatar
    118 posts
    Member since:
    Jan 2005

    Posted 11 Oct 2013 Link to this post

    How can I reset a RadTextBox to its configured EmptyMessage value using JavaScript?

    Note, I want to use the property value without having to state it twice.

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

    Posted 11 Oct 2013 Link to this post

    Hi Craig,

    Please check the following code I tried to clear the RadTextBox content and display the empty message.

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" EmptyMessage="Enter Name">
    </telerik:RadTextBox>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Clear Textbox" AutoPostBack="false"
        OnClientClicked="clearTextbox">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function clearTextbox(sender, args) {
            var radtextbox = $find('<%=RadTextBox1.ClientID %>');
            radtextbox.clear();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top