IBusinessBindable with OnValidate
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



IBusinessBindable with OnValidateExpand / Collapse
Author
Message
Posted 02/08/2008 4:55:12 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 7:28:28 PM
Posts: 1,148, Visits: 2,830
Based on the feedback from another post (http://forum.strataframe.net/FindPost13906.aspx) I was attempting to use OnValidate to update the data source. However, when I set this for a custom control I made, the set property never got fired (the data source was never updated). I implemented a property change event, but I'm thinking I must need a validate event also. What do I need to implement on this control to get OnValidate to work?
Post #14224
Posted 02/12/2008 10:57:09 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 7:28:28 PM
Posts: 1,148, Visits: 2,830
Bump....
Post #14322
Posted 02/12/2008 11:54:17 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
Well, this would depend on the control and property.  If you are inheriting a textbox and using the Text property, the you wouldn't have a problem.  You will have to fire the changed event of the property, and if one doesn't exists, then you need to create one.

Public Property MyBindingProperty As String
   Get
      Return _MyBindingProperty
   End Get
   Set (Byval value as String)
        _MyBindingProperty = value
        OnMyBindingPropertyChanged()
   End Set
End Property


Public Event MyBindingPropertyChanged As EventHandler


Private Sub OnMyBindingPropertyChanged()
    RaiseEvent MyBindingPropertyChanged(Me, EventArgs.Empty)
End Sub

This really shouldn't have anything to do with the IBusinessBindable, but rather the .NET binding that goes on behind the scenes one the SF binding creates the Binding class and adds it to the control.  So it as though you are just manually binding the control to the property (you would have the same results).

Post #14324
Posted 02/12/2008 12:15:42 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 7:28:28 PM
Posts: 1,148, Visits: 2,830
Already done this. Works great....until I change the control to update the data source OnValidate, then the set on the property never gets called, therefore the OnChanged event never gets called, and the field in the BO is never updated. So the question is, what needs to happen here so I can use the OnValidate to update the BO?
Post #14326
Posted 02/12/2008 12:53:51 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
This is a control level issue.  I am not sure if this is a custom control or not and it also depends on the type of control in which you are inheriting.  Validation in a textbox is invoked, for example, when you try to leave the field.  So it calls the OnValidating method which raises the Validating event.  This method call is never happening in your control.  If you are inheriting the UserControl, then you could override the OnValidating and/or the OnValidated method and add your logic to force this to update.
Post #14328
Posted 02/12/2008 1:30:15 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
One other thing.  If you are inherited a control that already has the OnValidated method, then just call it within your control when you want the control to validate and the binding should follow suit.
Post #14330
Posted 02/12/2008 2:38:15 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 7:28:28 PM
Posts: 1,148, Visits: 2,830
I'll look into this. This is a sub classes TextControl, by implementing IBusinessBindable. I'll have to see if it has/raises the Validating event. It should be fun if it doesn't
Post #14333
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 3:57pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 9 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.