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

Selecting the first item in RadComboBox does not fire

1 Answer 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adnan AlSmail
Top achievements
Rank 1
Adnan AlSmail asked on 04 Nov 2020, 07:04 AM

In Radgrid, I use RadComboBox to filter the contents of a column in the code behind as the DataSourceId of RadComboBox needs to be set programmatically based on the user's selection.  The filter works Ok and the SelectedIndexChanged fires an event in the code behind. However, when I select the first item, which I included in the markup to clear out the filter, an event does not fire and I cannot clear out the filter.

The item, which I include in the markup, looks like the following:

<Items>
        <telerik:RadComboBox Text="" Value="" />
</Items>

Any help will be appreciated.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 06 Nov 2020, 03:34 PM

Hi Adnan,

I have made a quick test and the RadComboBox will fire the event even if there is no Text or Value assigned to it.

You can test his behavior as well as using the following code:

<telerik:RadComboBox ID="RadComboBox1" runat="server" RenderMode="Lightweight" AutoPostBack="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
    <Items>
        <telerik:RadComboBoxItem Text="" Value="" />
        <telerik:RadComboBoxItem Text="Item 2" Value="Item2" />
        <telerik:RadComboBoxItem Text="Item 3" Value="Item3" />
        <telerik:RadComboBoxItem Text="Item 4" Value="Item4" />
    </Items>
</telerik:RadComboBox>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

 

C#

protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    Label1.Text += string.Format("SelectedIndexChanged fired. SelectedValue = {0}<br />", e.Value);
}

 

In your case, perhaps, there is AJAX involved and probably there are exceptions that are hidden by the AJAX framework. That would make it look like nothing happened after you have selected the first item.

In order to find out the issue, the first step of troubleshooting would be to remove AJAX from the ASPX Page, MasterPage, or UserControl if available. You can also disable it, but I suggest removing it because that makes sure there is no trace of it. See Get more descriptive errors by disabling AJAX

Once you remove the AJAX and try to replicate the issue if there was an exception it will now show up and give you a better idea of what the problem is. Eliminate the issue and add AJAX back to the page. 

I could also take a look at it myself and see if I can spot the issue, but for that, I would need to see the complete setup. How the Combo is bound, where it is located, how the data source is changed, etc.. It would be helpful if you could share more details like the complete ASPX page and ASPX.CS/ASPX.VB code.

I look forward to hearing from you.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Adnan AlSmail
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or