I have a repeater and inside my repeater I have
displayed some information from the database. In my
footer I have a dropdown box and a save button. The
user can select something from the dropdown and click
the save button to write to the database.
My problem is when the save button is clicked I get an
object referrence error. I can't figure out why this
is happening. Here is my code. It errors out on this
line:
Row.Item("InsuranceStatus") =
CType(FindControl("DD_InsurPayAction"),
DropDownList).SelectedItem.Value
Protected Sub Btn_Save_Click(ByVal sender As Object,
ByVal e As System.EventArgs)
Dim Adapter As SqlDataAdapter = New
SqlDataAdapter()
Dim EditCB As SqlCommandBuilder
Dim EditDS As DataSet = New DataSet()
Dim Row As DataRow
Adapter.SelectCommand = New SqlCommand("Select
* from tCollectionCurrent where AcctNum = " & _
Lbl_AccountNum.Text & "
and DOS = '" & Lbl_DOS.Text & "'", MyConnect)
EditCB = New SqlCommandBuilder(Adapter)
Adapter.Fill(EditDS, "CurrentCollection")
Row =
EditDS.Tables("CurrentCollection").Rows(0)
Row.Item("AcctNum") = Lbl_AccountNum.Text
Row.Item("DOS") = Lbl_DOS.Text
Row.Item("Status") = "2"
Row.Item("Priority") = "B"
Row.Item("InsuranceStatus") =
CType(FindControl("DD_InsurPayAction"),
DropDownList).SelectedItem.Value
Row.Item("PatientPmtStatus") =
DD_PatPayAction.SelectedItem.Value
Row.Item("CoPayStatus") =
DD_CoPayAction.SelectedItem.Value
Adapter.Update(EditDS, "CurrentCollection")
If EditDS.HasErrors Then
Lbl_Message.Text = "There was an error
Updating Current History Information, Please try
again." & _
EditDS.Tables("GetUser").Rows(0).RowError
Else
BindGrid()
Collections()
WriteCollectionHistory()
End If
End Sub