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

"Lost" onclick when RadAjaxManager used

0 Answers 81 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Leszek
Top achievements
Rank 1
Leszek asked on 16 Nov 2017, 05:00 PM

Hi, 

I have the following code (simplified to show the issue) with three ComboBoxes. Two of them are populated using an Ajax call. There is also a table with client-side click events:

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadComboBox1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                <telerik:AjaxUpdatedControl ControlID="RadComboBox2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadComboBox2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadComboBox2" />
                <telerik:AjaxUpdatedControl ControlID="RadComboBox3" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<table cellspacing="10">
    <tr height="100">
        <td style="width:100px;background-color:aquamarine;" onclick="alert('clicked');"></td>
        <td style="width:100px;background-color:burlywood" onclick="alert('clicked');"></td>
        <td style="width:100px;background-color:darkgreen" onclick="alert('clicked');"></td>
        <td style="width:100px;background-color:lightsteelblue" onclick="alert('clicked');"></td>
    </tr>
</table>
<telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" runat="server">
    <Items>
        <telerik:RadComboBoxItem Value="0" Text="[Select]" />
        <telerik:RadComboBoxItem Value="1" Text="AAA" />
        <telerik:RadComboBoxItem Value="2" Text="BBB" />
        <telerik:RadComboBoxItem Value="3" Text="CCC" />
    </Items>
    </telerik:RadComboBox>
<br />
<telerik:RadComboBox ID="RadComboBox2" AutoPostBack="true" OnSelectedIndexChanged="RadComboBox2_SelectedIndexChanged" runat="server" />
<br />
<telerik:RadComboBox ID="RadComboBox3" runat="server" />

Code behind:

protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    RadComboBox2.Items.Clear();
    for(int i = 1; i<10; ++i)
    {
        RadComboBoxItem item = new RadComboBoxItem();
        item.Text = "AAA-" + i.ToString();
        item.Value = i.ToString();
        RadComboBox2.Items.Add(item);
    }
    RadComboBox2.SelectedIndex = 0;
}
protected void RadComboBox2_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    RadComboBox3.Items.Clear();
    for (int i = 1; i < 10; ++i)
    {
        RadComboBoxItem item = new RadComboBoxItem();
        item.Text = "BBB-" + i.ToString();
        item.Value = i.ToString();
        RadComboBox3.Items.Add(item);
    }
    RadComboBox3.SelectedIndex = 0;
}

 

This is how to replicate the problem:

1. Select a value from RadComboBox1. This populates RadComboBox2 using Ajax.

2. Select a value from RadComboBox2. This populates RadComboBox3 using Ajax.

3. Click any of the table cells. The click event is "lost" (nothing happens).

4. Click another table cell. This time the click event is fired.

 

Why is that? Am I doing something wrong in the code?

 

Thanks,

Leszek

 

 

No answers yet. Maybe you can help?

Tags
Ajax
Asked by
Leszek
Top achievements
Rank 1
Share this question
or