This has got to be the easiest question in the world but I can't find a clear solution:
There are three fields in a formview: fldID, fldName, fldDatetime
All I want to do automatically insert the current date/time into the fldDatetime field which is hidden. I've tried a ton of different things but nothing works.
- What date type should I use for fldDatetime? there's datetime, smalldate, timestamp...etc.
- Which event is correct? I thought formview1.databinding was the most logical but one source said to do it on databound
- What's the simplest and most effective way to do this? (in VB if possible)
My current code (which is painfully wrong) is below.
Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound
Dim txt As TextBox
txt = FormView1.FindControl("cmtDateTextBox")
txt.Text = Now()