I have a Listview with a LinqDataSource.
I am allocating a resoure called Bladder Scanners to clinicians on the day selected. The field in the database, 'Allocated_Bladder_Scanner_Id', is tinyint and allows nulls.
The 'nullable' property of the field in the dbml is set to allow nulls.
In the edit template, I have an unbound dropdownlist (drpBladderScannerDropdown) with an 'empty string' item added to cater for nulls, and AppendDataBoundItems="true".
In order to show only bladder scanners which have not yet been allocated on the selected day, I am databinding the dropdownlist to a dictionary of unallocated bladder scanners in the ItemDataBound event. I then add the currently selected bladder scanner as a listitem and set it as the selected item.
So far, so good, all works well.
If the user elects to unallocate the clinician a bladder scanner by selecting 'Nothing' from the dropdownlist, I send a Nullable(of Byte) field to the dbml that is set to Nothing. The problem is that it won't update the field..
In ItemUpdating I have the following code:
I run through the dbml code in debug, but can't see how it is behaving differently to any other update.
Thanks
The risk with keeping an open mind is having your brains fall out.
Shaunk
I am allocating a resoure called Bladder Scanners to clinicians on the day selected. The field in the database, 'Allocated_Bladder_Scanner_Id', is tinyint and allows nulls.
The 'nullable' property of the field in the dbml is set to allow nulls.
In the edit template, I have an unbound dropdownlist (drpBladderScannerDropdown) with an 'empty string' item added to cater for nulls, and AppendDataBoundItems="true".
In order to show only bladder scanners which have not yet been allocated on the selected day, I am databinding the dropdownlist to a dictionary of unallocated bladder scanners in the ItemDataBound event. I then add the currently selected bladder scanner as a listitem and set it as the selected item.
So far, so good, all works well.
If the user elects to unallocate the clinician a bladder scanner by selecting 'Nothing' from the dropdownlist, I send a Nullable(of Byte) field to the dbml that is set to Nothing. The problem is that it won't update the field..
In ItemUpdating I have the following code:
Code:
Dim drpBladderScannerDropdown As DropDownList = CType(ListView1.Items(e.ItemIndex).FindControl("drpBladderScannerDropdown"), DropDownList)
If drpBladderScannerDropdown.SelectedValue = String.Empty Then
e.NewValues("Allocated_Bladder_Scanner_Id") = CType(Nothing, Nullable(Of Byte))
Else
e.NewValues("Allocated_Bladder_Scanner_Id") = drpBladderScannerDropdown.SelectedValue
End If
I run through the dbml code in debug, but can't see how it is behaving differently to any other update.
Thanks
The risk with keeping an open mind is having your brains fall out.
Shaunk