ClientEvent for "X" in RadTextBox?

2 posts, 0 answers
  1. john81
    john81 avatar
    36 posts
    Member since:
    Jan 2010

    Posted 22 May 2014 Link to this post

    When a RadTextBox has text in it, a "X" is rendered at the right side of the textbox that clears out the text in the textbox when clicked.  Is there a ClientEvent for clicking on the "X"?  I'd like to disable a button when the "X" is clicked.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 May 2014 in reply to john81 Link to this post

    Hi,

    As far as my knowledge RadTextBox doesn't have any Button inside the TextArea. In order to achieve your scenario you have to add an external button inside the TextBox as follows.

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" Skin="" CssClass="MyTextBox"
        Width="120px" />
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="http://i.imgur./z7ZSYjt.png"  OnClientClick="Close(); return false;"  CssClass="MyImageButton"  />

    CSS:
    <style type="text/css">
        .MyTextBoxWrapper
        {
            border: 1px solid blue;
            width: 150px;
            height: 20px;
        }
        .MyImageButton
        {
            margin-left: 1%;
            vertical-align: middle;
        }
    </style>

    JavaScript:
    <script type="text/javascript">
        function Close() {
            var imageButton = document.getElementById("ImageButton1");
            var radTextbox = $find("<%=RadTextBox1.ClientID %>");
            radTextbox.clear();
            //Your code
        }
    </script>

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