Hi,
I am working on a project for work that requires the <%# Now() %> function output to be inserted into a text box field that passes it's value to an Access 2007 DB with the rest of the form data on submission.

I am able to either make the textbox field display the Date/Time Stamp or for it to bind to the DB but can't do both.

Any assistance would be appreciated. :-)

I am using FormView in InsertItem mode.

Try this code in your program to bind Date with your textbox

private void BindTextBox()
{

DataTable dt = //set dataSource here
if (dt.Rows.Count > 0)

{
    TextBox1.Text = Convert.ToDateTime(dt.Rows[0][Field1]);//where field is the fieldname from your database   
    TextBox2.Text = Convert.ToDateTime(dt.Rows[0][Field2]);
 
}
}
protected void Page_Load(object sender, EventArgs e)
{
    
    if (!Page.IsPostBack)
    {
        BindTextBox();
    }

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.