Posted on: 9/4/2014 5:13:29 PM | Views : 429

I am trying to insert the current date and the username of the person who is authenticated via ASP>NET security.  I have tried the following code in the code behind:
Protected Sub FormView1_ItemInserting(sender As Object, e As FormViewInsertEventArgs) Handles FormView1.ItemInserting If FormView1.CurrentMode = FormViewMode.Insert Then Dim CrtDate As TextBox = TryCast(FormView1.FindControl("CrtDate"), TextBox) CrtDate.Text = DateTime.Now.ToString("d") End If End Sub If this had worked I was going to do a similar thing to set my CrtUID column to User.Identity.Name.  The error I get is: Object reference not set to an instance of an object. with the line CrtDate.Text = DateTime.Now.ToString("d") highlighted.  I know this is basic stuff but am I choosing the wrong event to try to do this during or am I missing some code.  Thanks!

Go to the complete details ...