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

[Solved] TextChange not fireing

4 Answers 194 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Per
Top achievements
Rank 1
Per asked on 09 Oct 2009, 11:56 AM
Hi

I have a combobox that uses LoadOnDemand

<

 

telerik:RadComboBox ID="rcCostLocation" AutoPostBack="true" CausesValidation="false" SkinId="RadCombo" Runat="server"

 

 

DropDownWidth="318px" Height="190px" Width="318px" EmptyMessage="Please select" EnableLoadOnDemand="True"

 

 

DataValueField="Id" ShowMoreResultsBox="true">

 

</

 

telerik:RadComboBox>

If I click on a item in the list, the SelectIndexChanged and TextChanged fires okey, but if I clear the text from the DropDownBox and then click anywhere on my page, the default text "Please select" is shown but the TextChange even never fires.

I need to check if the user has cleared the text in the combobox and then disable another control on the page.
Any suggestions on how I can accomplice this ?

Regards
Per

 

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Oct 2009, 08:09 AM
Hi Per,

I tried following client side code in order to accomplish this functionality. Attach OnClientBlur event to RadComboBox and check for the text and disable the control from client side.

JavaScript:
 
<script language="javascript"
    function OnClientBlur(sender, args) 
    { 
        var text =  sender.get_text(); 
        if(text == 'Please select'
        { 
          var textbox = document.getElementById("TextBox1"); 
          textbox.disabled = true;  // Disables TextBox control
         
        } 
    } 
</script> 

-Shinu.
0
Per
Top achievements
Rank 1
answered on 13 Oct 2009, 09:31 AM
Hi and thanks for you reply

However, I need to force the control to do a SelectedText changed event so I can process the information on the server.
Can I make the javascript call the same client function as the control normaly does when the text changes?

Regards
Per
0
Per
Top achievements
Rank 1
answered on 05 Nov 2009, 02:00 PM
Anyone know if its possible to force a postback if the users clears the combox text ?

Regards
Per
0
Yana
Telerik team
answered on 10 Nov 2009, 04:13 PM
Hi Per,

Please try it like this:

function OnClientBlur(sender, args)
{
    var text = sender.get_text();
    sender.postback();
}

the textChange event should be fired now.

Kind regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Per
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Per
Top achievements
Rank 1
Yana
Telerik team
Share this question
or