This is a migrated thread and some comments may be shown as answers.
Datasource Changed
3 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 06 Dec 2010, 10:54 PM
Hi i'm curetly overriding your Multicolumn control to apply sepcifics actions nedded by my application. I'm working to stop the selectedindexchanged event when changing the datasource property. I tried overriding databindingcomplete event to detect when datasource changed but this event is fired after selectedindexchanged event. My plan was to set a bool flag to true when the datasource changed to prevent selectedindexchange fire. Do there is an other way to make this hapen?

Thanks

Alexandre Samson

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 07 Dec 2010, 12:30 AM
Hello,

the simplest way is to remove the event handler, and then add it back in again.
E.g.

RemoveHandler Me.RadMultiColumnComboBox1.SelectedIndexChanged, AddressOf MultiColumnComboSelectedIndexChanged
' do stuff with data source
' re-select a value
AddHandler Me.RadMultiColumnComboBox1.SelectedIndexChanged, AddressOf MultiColumnComboSelectedIndexChanged

hope that helps
Richard
0
Alexandre
Top achievements
Rank 1
answered on 07 Dec 2010, 04:39 PM
I just made a custom class who is inheting MultiColumnCombobox class and overloaded the datasource property like this:

Private m_Bind As Boolean
 Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs)
     If Not m_Bind  Then
         MyBase.OnSelectedIndexChanged(e)
     End If
 End Sub
 Public Overloads Property DataSource() As Object
     Get
         Return MyBase.DataSource
     End Get
     Set(ByVal value As Object)
         m_Bind = True            
         MyBase.DataSource = value
         m_Bind = False
     End Set
 End Property

That's work.
0
Richard Slade
Top achievements
Rank 2
answered on 07 Dec 2010, 05:22 PM
Hello, 

Glad that you found a suitable way to solve your issue. 
Best regards, 
Richard
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Alexandre
Top achievements
Rank 1
Share this question
or