Tuesday, March 6, 2012

Orders: Setting Default Date

When creating a new order, the order date should default to the current date.

Switch back to the Designer, and expand the Orders controller in the Explorer. Expand Fields, and double click on OrderDate.

In the Code Default property, write:

DateTime.Now

Setting Code Default for OrderDate field in Code On Time Designer

Press OK to save the field. Press Generate in the top left corner, and wait for the page to load. Navigate to Order Form, and create a new order. Select a customer and employee. You will see that the current date has been inserted into the Order Date field.

Current Date inserted in Order Date for the Order Form

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com