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

Problem with Bindind combobox and SelectedIndex Changed

7 Answers 213 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pramod Goutham
Top achievements
Rank 1
Pramod Goutham asked on 23 Nov 2008, 06:43 AM
Hi,

Whenever I bind my radcomboxbox with a table in the dataset, the SelectedIndex Changed event gets fired automatically, causing exceptions in my winform, since I'm writing the SelectedIndex Changed event to retrieve some more data from the DB based on the value of the item selected in the radcombo box.

The code I have written is as below:

DataSet mydataset = helperObj.GetData();
radcombobox1.DataSource = mydataset.Tables[0];
radcombobox1.Text = "Please Select";

How can I avoid the event from being fired?

Thanks and Regards,
Pramod Goutham.

7 Answers, 1 is accepted

Sort by
0
Vassil Petev
Telerik team
answered on 26 Nov 2008, 04:55 PM
Hi Pramod Goutham,

Indeed, this is an issue that will be addressed soon. Thank you for reporting it.


Best wishes,
Vassil
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marcus Eddy
Top achievements
Rank 1
answered on 28 Jan 2009, 02:45 AM
The only way I found to get around this is subscribe and unsubscribe to the SelectedIndexChanged event programmatically before and after databinding, this way I had control over this event and could circumvent the inbuilt method calls.
0
Nick
Telerik team
answered on 29 Jan 2009, 07:32 PM
Thank you for sharing with the community your work-around, Marcus Eddy.

Best wishes,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Diederik
Top achievements
Rank 1
answered on 31 Jul 2009, 10:04 AM
Hi,

Is this problem solved in the 2009 Q1SP1 release? I am trying to bind a list of custom objects and the SelectedIndexChanged event triggers automatically.

Best regards.
0
Peter
Telerik team
answered on 31 Jul 2009, 01:18 PM
Hello Diederik,

This bug is not fixed yet and you should use the workaround from Marcus Eddy.

Please, excuse us for the inconvenience. The issue is logged in our TODO list and it will be addressed in some of the next releases. Don't hesitate to contact us if you have other questions.

Sincerely yours,
Peter
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
southwynd
Top achievements
Rank 1
answered on 08 Sep 2009, 09:27 PM
I'm having this same issue.  I want to populate a RadGridView, but only after selecting an item from the RadComboBox  I've attempted to remove/add the SelectedIndexChanged event like this:

    Private Sub ddlProtocols_ItemDataBound(ByVal sender As ObjectByVal e As ItemDataBoundEventArgs) Handles ddlProtocols.ItemDataBound 
        AddHandler ddlProtocols.SelectedIndexChanged, AddressOf ddlProtocols_SelectedIndexChanged 
 
        ' My code here for formatting RadComboBoxItem tags
 
        RemoveHandler ddlProtocols.SelectedIndexChanged, AddressOf ddlProtocols_SelectedIndexChanged 
    End Sub 

And then populate my RadGridView like this:

    Private Sub ddlProtocols_SelectedIndexChanged(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles ddlProtocols.SelectedIndexChanged 
        ' My code here for populating the RadGridView
    End Sub 

But the SelectedIndexChanged continues to fire multiple times before I've selected an item from the RadComboBox.  Any ideas on how I can get this workaround to work?
0
Peter
Telerik team
answered on 11 Sep 2009, 11:54 AM
Hello southwynd,

Thank you for writing. You should unsubscribe from the event before the databinging and subscribe after that. Please, refer to the code snippet:
 
RemoveHandler ddlProtocols.SelectedIndexChanged, AddressOf ddlProtocols_SelectedIndexChanged  
 
me.radGridView1.DataSource = table1 
 
AddHandler ddlProtocols.SelectedIndexChanged, AddressOf ddlProtocols_SelectedIndexChanged  
 
 

Hope this helps.

Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Pramod Goutham
Top achievements
Rank 1
Answers by
Vassil Petev
Telerik team
Marcus Eddy
Top achievements
Rank 1
Nick
Telerik team
Diederik
Top achievements
Rank 1
Peter
Telerik team
southwynd
Top achievements
Rank 1
Share this question
or