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

RadCombo javascript throws exception on SelectedIndexChanged when Value is apostrophe

5 Answers 147 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 16 Nov 2011, 12:47 AM
Hi all,

Very simple.  I am binding the RadCombo in markup and code-behind as follows.  So, when the user selects a value in the RadComboBox that contains an apostrophe, some javascript exception is thrown and the server-side postback event handler is never invoked.  We are using version 2011.2.712.35.

Please help.

Thank you,

Dan

 Markup:

 

<td>

 

 <telerik:RadComboBox ID="request__place_id" CssClass="LabelValue" AutoPostBack="true"

OnSelectedIndexChanged="request__place_idSelectedIndexChanged"

runat="server">

 

</telerik:RadComboBox>

 

 </td>


Code-behind:

 

var values = from info in result.Descendants("place")

 

select new

{

    PlaceId = info.Element(

"place_id"),

    Name = info.Element(

"name")

};

 

this.request__place_id.Items.Clear();

 

this.request__place_id.Items.Add(new RadComboBoxItem(string.Empty, string.Empty));

 

foreach (var value in values)

    this.request__place_id.Items.Add(new Telerik.Web.UI.RadComboBoxItem(value.Name.Value, value.PlaceId.Value));

}

5 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 18 Nov 2011, 05:08 PM
Hello Daniel,

I did not manage to reproduce the same behavior locally. I have been testing the following:
<telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
    <Items>
        <telerik:RadComboBoxItem Value="'value1"  Text="'item1" />
        <telerik:RadComboBoxItem Value="'value2"  Text="'item2" />
        <telerik:RadComboBoxItem  Value="'value3" Text="'item3" />
    </Items>
</telerik:RadComboBox>
The SelectedIndexChanged event is fired as it should and there are no JavaScript errors.

If you are still having troubles, you could open a support ticket and send us runnable sample page with the issues isolated in it, so we would be able to troubleshoot this behavior locally.

Best wishes,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 21 Nov 2011, 03:13 PM
Okay, now place a RadScriptManager on the page and put the markup I originally submitted into an UpdatePanel.  The error will manifest itself.

Thanks,

Dan
0
Ivana
Telerik team
answered on 24 Nov 2011, 09:36 AM
Hello Daniel,

I still can not produce the behavior in question locally. I have been testing the following:

<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <telerik:RadComboBox runat="server" ID="ComboBox1" OnSelectedIndexChanged="ComboBox1_SelectedIndexChanged"
            AutoPostBack="true">
            <Items>
                <telerik:RadComboBoxItem Value="'value1" Text="'item1" />
                <telerik:RadComboBoxItem Value="'value2" Text="'item2" />
                <telerik:RadComboBoxItem Value="'value3" Text="'item3" />
            </Items>
        </telerik:RadComboBox>
    </ContentTemplate>
</asp:UpdatePanel>
protected void ComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    RadComboBoxItem item = new RadComboBoxItem();
    item.Text = e.Text + "_new";
    item.Value = e.Value + "_'";
    ComboBox1.Items.Add(item);
}

Could you send me a runnable sample page or paste here the exact text/values you are setting to the items, so I can use the very same page on which the issue is produced.

Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 28 Nov 2011, 05:04 PM
I am working with IE9.  Please attempt the problem reproduction with IE9. 

Thank you,

Dan
0
Ivana
Telerik team
answered on 01 Dec 2011, 04:24 PM
Hi Daniel,

I have tested the code I have pasted in the previous message in IE 7, 8, 9 and everything works as it should. No JavaScript error is thrown, and the SelectedIndexChanged server-side event is invoked as it should. You could visit the video linked below, to see how the RadComboBox behaves when I test it locally:
RadComboBox: Items containing Apostrophe Values.

If still having troubles, could you paste the JavaScript error you are getting,  here? Or, send us a support ticket with the issue isolated in a sample page?

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Daniel
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or