StrataFrame Forum

DatePicker in BrowseDialog not working

http://forum.strataframe.net/Topic8892.aspx

By rmoore - 5/18/2007

I have a browse dialog and want to show a datepicker in but it's only showing as a textbox. I have made sure that the field in the database is of datetime and that is was mapped successfully in the business object. I have tried it on another browse dialog with the same results. Any ideas?
By Trent L. Taylor - 5/21/2007

The BrowseDialog will automatically show a date time picker for any field type of a DateTime.  So the only reason you would not be getting a date/time picker is if your BO property that the field represents is not of a DateTime data type.

The above image shown is representing the cust_Created field on the Customers BO in the VB.NET tutorial.  I went in and created a browse, added the cust_Created field to the SearchFields collection, associated the BrowseDialog with the MaintenanceFormToolstrip and ran and received the results above.  Below is a screen shot of the strong-typed property of the field which can be found in the designer.vb file of the BO.

By rmoore - 5/22/2007

I have verified that that the datatype is a date. Here is screenshot of the designer.vb file of the BO.



By Ben Hayat - 5/22/2007

Is this field set to "Allow Null"? I suspect it's looking for "Nullable" type rather date type!
By Trent L. Taylor - 5/22/2007

Ben Hayat is correct.  The GetType() does not return a DateTime but rather a Nullable data type....thus you will never get a DateTime field.  You are better off using the Return Alternate Value on Null rather than Nullable within the Customization so that the data type remains a DateTime but allows for a NULL exception.  As long as you have your field typed as a Nullable (or use Nullable Generics within the customization) the BrowseDialog will never see that property as a DateTime.