I have a datagrid that pulls in the information. I have a Edit button that works fine. When I go to edit a row, and click the Update button, I get an error saying:
Object reference not set to an instance of an object.
The code breaks on the
dname = CType(e.Item.FindControl("txtDeceasedName"), TextBox).Text line.
VB Code:
'Retrieve the data from the DataGrid Dim mID As Integer Dim dname As String Dim relatedto As String Dim relationship As String Dim dateofdeath As Date Dim notes As String Dim visitation As String Dim funeral As String mID = dgMemoriam.DataKeys(e.Item.ItemIndex) dname = CType(e.Item.FindControl("txtDeceasedName"), TextBox).Text relatedto = CType(e.Item.FindControl("txtRelatedTo"), TextBox).Text relationship = CType(e.Item.FindControl("txtRelationship"), TextBox).Text dateofdeath = CType(e.Item.FindControl("txtDateofDeath"), TextBox).Text notes = CType(e.Item.FindControl("txtNotes"), TextBox).Text visitation = CType(e.Item.FindControl("txtVisitation"), TextBox).Text funeral = CType(e.Item.FindControl("txtFuneral"), TextBox).Text




Reply With Quote