Forum
smartDBforms.NET for ASP.NET 2
 
 
Knowledge Base Forum
To post messages on the forum, you need to login first.
SearchForum Home
  Product Forums  smartDBforms.NET  Current Date se...
 Current Date setting in forms
 
 6/9/2010 6:54:44 PM
David
10 posts


Current Date setting in forms

Is there a way to set a date field on a smartdbform to be the current date? I know in other programs there is =Now() etc. what would be the correct syntax and where would it go.

This is for an insert form binding a field in a table that is capturing the entry date of the form.

 6/11/2010 3:29:00 AM
Adillis Support
43 posts
adillis.com


Re: Current Date setting in forms


Hi David,

You can set the initial value to be today date by dynamically initializing the corresponding insert parameter's default value to the system current date. In order to do it you should handle the Page Load event and add code which will assign the current date to the insert parameter. To create Page Load handler in design-time double click somewhere on empty space in the page. In the event handler put the following code, just replace the names of data source and parameter:
protected void Page_Load(object sender, EventArgs e)
{
  SmartDataSourceSelectedEmpoyee.InsertParameters["HireDate"].DefaultValue = DateTime.Today.ToString();
}

In Visual Basic the code will be:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
   SmartDataSource1.InsertParameters("HireDate").DefaultValue = DateTime.Today.ToString()
End Sub

If you have any other questions, we will be more than happy to help you.
Best wishes,
Adillis Support
Adillis - IT solutions http://adillis.com

  Product Forums  smartDBforms.NET  Current Date se...
Copyright 2006-2010 Adillis Terms Of Use Feedback Contact Us