I am tring to save information based on if they pick a date back inot the Db. So I am checking on the selectedvalue of the raddatepicker but it gives me this error when I do not have a date in there.
Bassically what I want to do is rotate through my radgrid and if they have picked a date then save information to the DB otherwise just go to the next row. But this error pops if no date is picked.
Bassically what I want to do is rotate through my radgrid and if they have picked a date then save information to the DB otherwise just go to the next row. But this error pops if no date is picked.
Nullable object must have a value.
Line 238: If TempDt.SelectedDate.Value > Nothing Then
Protected Sub lnkSaveTemp_Click(sender As Object, e As System.EventArgs) Handles lnkSaveTemp.Click For Each row As GridDataItem In myRadGrid.Items Dim Id As Integer = row.GetDataKeyValue("intIssuedId") Dim TempDt As RadDatePicker = DirectCast(row.FindControl("DatePicker"), RadDatePicker) Dim TNote As TextBox = DirectCast(row.FindControl("txtNotes"), TextBox) If TempDt.SelectedDate.Value > Nothing Then sql = "Update Drat_Issued set dtRecoverTemp = '" & sanitizeString(TempDt.SelectedDate.Value) & "', strNotes = '" & sanitizeString(TNote.Text) & "' where intIssuedId = " & Id Response.Write(sql) insertUpdateDelete(sql) End If Next End Sub