Setting the DataSource in the SelectedIndexChanged event will trigger the event again. Thus leading to StackOverflowException.
A possible workaround will be to unsubscribe from the event when changing the DataSource property or raise a flag which can be checked in the event handler.
Hello Maheswari,
The SelectedIndex and DataSource scenarios will be addressed in the logged feedback item.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Dinko,
Thank you for your response. Let explain about dynamic dropdownlist in my next forum.
Now we need fix for the below items.
As I mentioned in the previous forum, We need fix for Raddropdownlist.DataSource as well as Raddropdownlist.SelectedIdex.
When we set the Datasource as well as SelectedIndex=5 or some value in selectedIndexchangedEvent then the recursive call is happening so we need to restrict for both Raddropdownlist.DataSource as well as Raddropdownlist.SelectedIdex.
private void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
fillIndustryProcess1(); // radDropDownList1.DataSource = dt; when we set Datasource the recursive call is occurring
radDropDownList1.SelectedIdex = 5;
}
public void fillIndustryProcess1()
{
try
{
System.Data.DataTable dt = new System.Data.DataTable(); //this will be local instantiation throughout product
if (dt.Columns.Count > 0)
{
dt.Columns.Add("Industry", typeof(string));
dt.Columns.Add("ID", typeof(int));
dt.Rows.Add("BGL-0", 0);
dt.Rows.Add("BGL-1", 1);
dt.Rows.Add("BGL-2", 2);
dt.Rows.Add("BGL-3", 3);
dt.Rows.Add("BGL-4", 4);
radDropDownList1.DisplayMember = "Industry";
radDropDownList1.ValueMember = "ID";
}
}
catch (System.ComponentModel.Win32Exception ex)
{
throw ex;
}
}
Thanks,
Maheswari
Hi Maheswari,
I can't bind to a time frame when the fix will be available. I can see that the status of the item is set to In Development. This means that our team is working on to provide a fix. As soon as they are ready, the status of the item will be changed and information on which release the fix will be available will be added.
As for your second post, I am not sure what you mean by dynamic RadDropDownList controls. If you mean that you won't be aware of the type of control that will access your code and a general object will arrive, then you could check the type of the object control and only then subscribe or unsubscribe from the selection events. If this is not the case, you can share some more details. You could create a sample project which demonstrate this and attached it here.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Dinko,
Our code will be dynamic where the Raddropdownlist can be anything, in such case how we can find the Raddropdownlist having selectedIndexChanged event or not.? Is there any way to find the SelectedIndexChanged for dynamic Raddropdownlist?
private void FillSelectionCombo(Telerik.WinControls.UI.RadDropDownList tempCombo, Common.Attributes AttID, int ModelID)
{
try
{
tempCombo.DisplayMember = "Name";
tempCombo.ValueMember = "ID";
tempCombo.SelectedIndexChanged -= new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.tempCombo_SelectedIndexChanged); // This will throw error
tempCombo.DataSource = Common.GetValidValues(((Common.Model)ModelID), AttID, ((Common.Manufacture_Site)PNxt_BL.LineItem.CurrentLineItem.SiteId), PNxt_BL.LineItem.CurrentLineItem.QuotationDateCnt, 1);
if (tempCombo.Items.Count > 0)
{
tempCombo.SelectedIndex = 0;
}
tempCombo.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.tempCombo_SelectedIndexChanged);// This will throw error
}
catch (Exception ex)
{
}
}
Thanks,
Maheswari
Hi Dinko,
Already we had spent much time to do subscribe and unsubscribe even though it was not working. If is it doable we supposed to do. We put lot of effort however it was ended up with stackoverflow exception. It is legacy project hence we are getting trouble when try to use latest Telerik.
In my previous forum, I had highlighted this issue in back ground color. However it was not fixed.
So could you please tell me when it will be fixed to test and purchase?
Thanks,
Maheswari
Hello Maheswari,
I appreciate your time to report this behavior.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.