MaintenanceFormToolStrip with dateTimePicker


Author
Message
Tony DeSanto
Tony DeSanto
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 99
I have a dateTimePicker control placed on a standard SF Maintenance Form.  The dateTimePicker control is setup to clear on null when the value is 1/1/1800.  What is happening is when I use the Maintenance forms navigator and move to a record with a null value the dateTimePicker control displays a blank field which is correct but the navigator becomes grayed out and the MaintenanceFormToolStrip only allows New, Edit or Delete to be selected.  I'm unsure of why the navigator becomes grayed out.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Tony, the behaviour you are describing does not really make any sense.  I beleive you in that you are having this happen to you, but the two are unrelated.  Can you reproduce this in a quick sample?
Tony DeSanto
Tony DeSanto
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 99
Using Tutorial_WinCSharp14:

I first added a dateTimePicker to the Customer Maintenance Form.  Associate the control to the cust_Created field.  I then changed the StrataFrame database in order for the cust_Created Field to allow nulls.  Then I remapped the business objects and recompiled the application.  Null out one of the records for the cust_Created fields and then run the application.  Then try to navigate on and off of that record.

Tony DeSanto
Tony DeSanto
StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)StrataFrame Beginner (3 reputation)
Group: Forum Members
Posts: 3, Visits: 99
What happens is when I navigate to a record with a null date the dateTimePicker clears out the control correctly but the business object becomes dirty which I believe is causing the navigation controls to gray out.  Is this the correct behavior?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Ahhh...yeah, that is what is happening to you.  Yes, the reason is because the EditingStateChanged event fired.  You can control the EditingStateChanged a number of different ways, but that is what happened.  This is correct in the fact that when the EditingState changes on the BO that the MaintenanceFormToolstrip will respect this.  There are several things you could do in this situation.  For example, if you set the AllowMultipleModifiedRecords property to True on the MaintenanceFormToolstrip, then the navigation will not become disabled since more than one record could be modified at the same time.  Depending upon how you have the field setup to manage the NULLs in conjunction with the bound control, the value may or may not actually update the field itself.  By default, the DateTimePicker will "clear out" the field on a NULL value but not actually change the underlying value.  That is why there is the ClearKey which when pressed will in fact set the field in the table back to NULL.
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)StrataFrame User (267 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Trent L. Taylor (08/21/2007)
Ahhh...yeah, that is what is happening to you. Yes, the reason is because the EditingStateChanged event fired. You can control the EditingStateChanged a number of different ways, but that is what happened. This is correct in the fact that when the EditingState changes on the BO that the MaintenanceFormToolstrip will respect this. There are several things you could do in this situation. For example, if you set the AllowMultipleModifiedRecords property to True on the MaintenanceFormToolstrip, then the navigation will not become disabled since more than one record could be modified at the same time. Depending upon how you have the field setup to manage the NULLs in conjunction with the bound control, the value may or may not actually update the field itself. By default, the DateTimePicker will "clear out" the field on a NULL value but not actually change the underlying value. That is why there is the ClearKey which when pressed will in fact set the field in the table back to NULL.




Hello, I testing the datetimepicker control, I allow null values on the database, I open the BOM and see that do not allow nulls are the default... if I test the form with the datetimepicker a error "not valid convertion from 'DBNull' to "Date' type, then I open again the BOM and set an alternate on null (#1/1/1800#) and when I test it, when null values are found it worked (show a blank value), but when a value is found (the field not is null) the editingstate change.



How I can avoid to handle this event and only show the datetime value from the field?

thanks!
Randy Jean
Randy Jean
StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)StrataFrame User (167 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Same problem I'm having... Let me know if you found a solution. I don't want the underlying buffer to be dirty when I navigate and the get of the field behavior fires regardless of how the UI handles it.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This is the purpose of the NULL settings within the BO Mapper.  Create a Return Alternate Value on NULL value and set the return value to #1/1/1800# and then rebuild the partial.  So when there is a date value that is null, the BO property will return #1/1/1800# and it will be treated as a NULL by the DateTimePicker.
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