I'm developing a new website using a MySQL database and VS2015. I'm trying to get default values displayed when the user hits "new" on a detailsview. I'm am trying code that fires on Databinding but when the user hits "new" I get a Nullreferenceexception. Users on other forums claimed that this worked.
Any suggestions?

Recommended Answers

All 2 Replies

Maybe some code to view? It's a bit tough to give advice otherwise.

I also tried the following code tied to a hyperlink on the page and get the same result:

    Protected Sub DetailsView1_DataBound(sender As Object, e As EventArgs) Handles DetailsView1.DataBound
        If DetailsView1.CurrentMode = DetailsViewMode.Insert Then

            DirectCast(DetailsView1.FindControl("Material"), TextBox).Text = "0.00"


        End If
    End Sub
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.