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

[Solved] Selected value doesn't "stick" in Firefox, but works in IE7 and Safari.

3 Answers 129 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 07 May 2009, 01:32 PM
I have two combo boxes. The value of the second is defaulted based on the value of the first. I am using JavaScript to call an AJAX web service and to update the second combo box.

Here is part of my source code in C#:

        StringBuilder javaScript = new StringBuilder(); 
        javaScript.Append("saveLuminaireInvestment("); 
        javaScript.Append("$get('" + this.lblLuminaireID.ClientID + "').innerHTML, "); 
        javaScript.Append("$find('" + this.RadComboBoxExistingLuminaire.ClientID + "').get_value(), "); 
        javaScript.Append("$find('" + this.RadComboBoxTCPLuminaire.ClientID + "').get_value(), "); 
        javaScript.Append("$get('" + this.txtQuantity.ClientID + "').value, "); 
        javaScript.Append("$get('" + this.txtTCPQuantity.ClientID + "').value, "); 
        javaScript.Append("$get('" + this.txtTCPCostPerFixture.ClientID + "').value, "); 
        javaScript.Append("$get('" + this.txtTCPInstallCost.ClientID + "').value, "); 
        javaScript.Append("$get('" + this.txtTCPRebate.ClientID + "').value"); 
        javaScript.Append("); "); 
 
        StringBuilder javaScript2 = new StringBuilder(); 
        javaScript2.Append("LinearCalcWS.getTCPFixtureEquiv($find('" + RadComboBoxExistingLuminaire.ClientID + "').get_value(), function(result) { if (result != null) { "); 
        javaScript2.Append("$find('" + this.RadComboBoxTCPLuminaire.ClientID + "').findItemByValue(result.TCPFixtureID).select(); "); 
        javaScript2.Append("$get('" + this.lblExistFixtureDesc.ClientID + "').innerHTML = result.ExistingFixtureDescription; "); 
        javaScript2.Append("$get('" + this.lblTCPFixtureDesc.ClientID + "').innerHTML = result.TCPFixtureDescription; "); 
        javaScript2.Append(javaScript.ToString()); 
        javaScript2.Append("} });"); 
 
        StringBuilder javaScript3 = new StringBuilder(); 
        javaScript3.Append("LinearCalcWS.getTCPFixtureDescription($find('" + RadComboBoxTCPLuminaire.ClientID + "').get_value(), function(result) { if (result != null) { "); 
        javaScript3.Append("$get('" + this.lblTCPFixtureDesc.ClientID + "').innerHTML = result; "); 
        javaScript3.Append(javaScript.ToString()); 
        javaScript3.Append("} });"); 
 
        RadComboBoxExistingLuminaire.OnClientSelectedIndexChanged = "function() {" + javaScript2.ToString() + "}"
        RadComboBoxTCPLuminaire.OnClientSelectedIndexChanged = "function() {" + javaScript3.ToString() + "}"
 


In IE7, when I select a value from the first ComboBox (RadComboBoxExistingLuminaire), it properly updates the value of the second ComboBox (RadComboBoxTCPLuminaire) and also updates a couple of labels in the User Control. The second combo box is set based on the value of the first. Sort of a recommended replacement function.

It also properly saves the data via the AJAX call to the database. No problem.

However, in FireFox, when I select a value in the first combo box, it properly updates the second combobox and the labels, BUT, once I click off of the first combo box (to move to a text box, for example) or tab to the next control, the first combo resets itself to some random index (and then also causes the second combo box to set itself to a different value).

It's not always reproducable as to which index it will get set to.

To give you the bigger picture of where the RadComboBoxes are, the page has an AjaxControlToolkit TabPanelContainer control on it (this was developed before we started using Telerik controls) and within the container, is the TabPanel that this is on. In that TabPanel is a repeater, and the elements of the repeater are a user control and the user control contains the combo boxes.

It appears to be working fine in IE7 (and Safari), but not in FireFox.

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 11 May 2009, 12:07 PM
Hello Greg,

I am not able to replicate the described issue with this code, could you please prepare a simple page illustrating the problem and send it to us so we can test it locally?  You should open a support ticket in order to be able to attach files. Thanks

Best wishes,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Greg
Top achievements
Rank 1
answered on 11 May 2009, 03:42 PM
I determined that this happens any time you set the Filter to anything other than default. See the sample markup below. When you select an item from the first combo box and click the empty text field, the value changes.

When you select the second combo box, and click the text field, no problems.

This also occurs when you set the Filter to "StartsWith".

Perhaps I am using these attributes wrong?

Also, this is not a FireFox only issue. It also happens in IE

Greg

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <telerik:RadComboBox ID="RadComboBox1" Runat="server" Skin="Vista"  
    Filter="Contains"
    <Items> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1"  
            Value="RadComboBoxItem1" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2"  
            Value="RadComboBoxItem2" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3"  
            Value="RadComboBoxItem3" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4"  
            Value="RadComboBoxItem4" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem5"  
            Value="RadComboBoxItem5" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem6"  
            Value="RadComboBoxItem6" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem7"  
            Value="RadComboBoxItem7" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem8"  
            Value="RadComboBoxItem8" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem9"  
            Value="RadComboBoxItem9" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem10"  
            Value="RadComboBoxItem10" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem11"  
            Value="RadComboBoxItem11" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem12"  
            Value="RadComboBoxItem12" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem13"  
            Value="RadComboBoxItem13" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem14"  
            Value="RadComboBoxItem14" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem15"  
            Value="RadComboBoxItem15" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem16"  
            Value="RadComboBoxItem16" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem17"  
            Value="RadComboBoxItem17" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem18"  
            Value="RadComboBoxItem18" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem19"  
            Value="RadComboBoxItem19" /> 
    </Items> 
</telerik:RadComboBox> 
<telerik:RadComboBox ID="RadComboBox2" Runat="server" Skin="Vista"
    <Items> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1"  
            Value="RadComboBoxItem1" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2"  
            Value="RadComboBoxItem2" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3"  
            Value="RadComboBoxItem3" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4"  
            Value="RadComboBoxItem4" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem5"  
            Value="RadComboBoxItem5" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem6"  
            Value="RadComboBoxItem6" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem7"  
            Value="RadComboBoxItem7" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem8"  
            Value="RadComboBoxItem8" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem9"  
            Value="RadComboBoxItem9" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem10"  
            Value="RadComboBoxItem10" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem11"  
            Value="RadComboBoxItem11" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem12"  
            Value="RadComboBoxItem12" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem13"  
            Value="RadComboBoxItem13" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem14"  
            Value="RadComboBoxItem14" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem15"  
            Value="RadComboBoxItem15" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem16"  
            Value="RadComboBoxItem16" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem17"  
            Value="RadComboBoxItem17" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem18"  
            Value="RadComboBoxItem18" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem19"  
            Value="RadComboBoxItem19" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem20"  
            Value="RadComboBoxItem20" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem21"  
            Value="RadComboBoxItem21" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem22"  
            Value="RadComboBoxItem22" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem23"  
            Value="RadComboBoxItem23" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem24"  
            Value="RadComboBoxItem24" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem25"  
            Value="RadComboBoxItem25" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem26"  
            Value="RadComboBoxItem26" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem27"  
            Value="RadComboBoxItem27" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem28"  
            Value="RadComboBoxItem28" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem29"  
            Value="RadComboBoxItem29" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem30"  
            Value="RadComboBoxItem30" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem31"  
            Value="RadComboBoxItem31" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem32"  
            Value="RadComboBoxItem32" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem33"  
            Value="RadComboBoxItem33" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem34"  
            Value="RadComboBoxItem34" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem35"  
            Value="RadComboBoxItem35" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem36"  
            Value="RadComboBoxItem36" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem37"  
            Value="RadComboBoxItem37" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem38"  
            Value="RadComboBoxItem38" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem39"  
            Value="RadComboBoxItem39" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem40"  
            Value="RadComboBoxItem40" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem41"  
            Value="RadComboBoxItem41" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem42"  
            Value="RadComboBoxItem42" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem43"  
            Value="RadComboBoxItem43" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem44"  
            Value="RadComboBoxItem44" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem45"  
            Value="RadComboBoxItem45" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem46"  
            Value="RadComboBoxItem46" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem47"  
            Value="RadComboBoxItem47" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem48"  
            Value="RadComboBoxItem48" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem49"  
            Value="RadComboBoxItem49" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem50"  
            Value="RadComboBoxItem50" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem51"  
            Value="RadComboBoxItem51" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem52"  
            Value="RadComboBoxItem52" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem53"  
            Value="RadComboBoxItem53" /> 
    </Items> 
</telerik:RadComboBox> 
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
 
    </form> 
</body> 
</html> 
 

0
Simon
Telerik team
answered on 14 May 2009, 08:53 AM
Hi Greg,

Thank you for providing the sample code.

This issue has been resolved in the latest Internal Build of Telerik.Web.UI. Please download it from your Client.net account and upgrade if this is an option for you.

Greetings,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Greg
Top achievements
Rank 1
Answers by
Yana
Telerik team
Greg
Top achievements
Rank 1
Simon
Telerik team
Share this question
or