Trouble with IBusinessBindable


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm attempting to implement IBusinessBindable. It works great to load the control, but it is not saving the changes. I have the property setup as it should be but it isn't saving changes. I'm not sure were to look. I copied from the IBusinessBindable example. It seemed pretty straight forward.



What might I be doing wrong? Ermm
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ah, more info. It does save changes, just not the last change made. I was just making one change, then trying to save it. If I make two, it saves the first, but not the second...
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Most likely it's one of 2 things... either the DataSourceUpdateMode is not set to OnPropertyChanged, or the control is not properly raising a PropertyChanged event. 

If it's a basic control, then make sure on the control that the DataSourceUpdateMode defaults to OnPropertyChanged... otherwise, it might default to OnValidation, which might not always fire. 

If it's a custom control, then you'll need to either create a <PropertyName>Changed event (i.e. if your property is "Value" then you need an event called "ValueChanged") that is of type EventHandler or implement the INotifyPropertyChanged interface and use the PropertyChanged event. 

The easiest if probably the first one (not the INotifyPropertyChanged interface), so create the event for your property.  In VB, you have to explicitly set it as type EventHandler, so do this:

Public Event ValueChanged As EventHandler

not:

Public Event ValueChanged(ByVal sender As Object, ByVal e As EventArgs)

Then, raise the event within the Set of the property when the value changes like so: RaiseEvent ValueChanged(Me, EventArgs.Empty)

If you want to use the INotifyPropertyChanged event, then in the Setter of the property you have to raise the PropertyChanged event like this: RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("Value"))

The whole reason for the changed events is that the data-binding within .NET adds a handler to the changed event so that is knows when to copy the data from the control to the data source.  If you don't have the event, then the data never gets copied back.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks. This is being used on an HTML editor control, so I'm not surprised that there might be some problem with it reliably raising the event. I'll look into it.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search