RadtextBox not clear

2 posts, 0 answers
  1. sudheer
    sudheer avatar
    109 posts
    Member since:
    Dec 2008

    Posted 24 Dec 2008 Link to this post

    Hi

    i have a RadTextbox ,RadCombobox,in which end user can enter text  and select values from combobox.
     beside to that clear button is also available .
    once if i click  clear button i want to delete text value and combobox value should become default value as 'SELECT'.

    i am able to clear textbox value but once again if i focus on textbox , it retains and shows previous entered value.

    Any help appreciable.
  2. Dimo
    Admin
    Dimo avatar
    8457 posts

    Posted 24 Dec 2008 Link to this post

    Hello sudheer,

    I don't know how are you clearing the textbox, but here is a working example:

    <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientSelectedIndexChanged="SelectedIndexChanged" > 
        <Items> 
            <telerik:RadComboBoxItem Value="0" Text="" /> 
            <telerik:RadComboBoxItem Value="1" Text="One" /> 
            <telerik:RadComboBoxItem Value="2" Text="Two" /> 
            <telerik:RadComboBoxItem Value="3" Text="Three" /> 
        </Items> 
    </telerik:RadComboBox> 
     
    <telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
     
    <asp:Button ID="btnClear" runat="server" OnClientClick="ClearValues();return false;" Text="Clear" /> 
     
    <script type="text/javascript"
     
    function SelectedIndexChanged(sender, args) 
        if (args.get_item().get_value() != 0) 
        { 
            var textBoxNewValue = args.get_item().get_value() + ": " + args.get_item().get_text(); 
            $find("<%= RadTextBox1.ClientID %>").set_value(textBoxNewValue); 
        } 
        else 
        { 
            $find("<%= RadTextBox1.ClientID %>").clear(); 
        } 
     
    function ClearValues() 
        $find("<%= RadTextBox1.ClientID %>").clear(); 
        $find("<%= RadComboBox1.ClientID %>").clearSelection(); 
     
    </script> 


    Regards,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top