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

ClientEvent for "X" in RadTextBox?

1 Answer 87 Views
Input
This is a migrated thread and some comments may be shown as answers.
john81
Top achievements
Rank 1
john81 asked on 22 May 2014, 05:57 PM
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.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 May 2014, 05:51 AM
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.
Tags
Input
Asked by
john81
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or