Hi,
Im having a bit of trouble with the DropDownList control, on a bit data type. I have one screen for inserting records, and another for updating. The insert works fine, but my update screen keeps crashing with the message "lstBluetooth has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value"
The code I have for the dropdown is:
Ive tried changing the Value field for the 2 ListItems to 0 and 1 (as this is all that will ever be retrieved from the field Bluetooth which is defined as a bit in the database).
The above code for the DropDownList works fine on my insert page. The template field above exists in a DetailsView control, which used a PageDataSource for binding.
Any ideas on how to get this working?
Im having a bit of trouble with the DropDownList control, on a bit data type. I have one screen for inserting records, and another for updating. The insert works fine, but my update screen keeps crashing with the message "lstBluetooth has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value"
The code I have for the dropdown is:
Code:
<asp:TemplateField HeaderText="Bluetooth">
<EditItemTemplate>
<asp:DropDownList ID="lstBluetooth" runat="server" Width="100px"
DataValueField="Bluetooth" SelectedValue=<%# Bind("Bluetooth") %>>
<asp:ListItem Text="True" Value="true"/>
<asp:ListItem Text="False" Value="false"/>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblBluetooth" runat="server" Text=<%# Eval("Bluetooth") %> />
</ItemTemplate>
</asp:TemplateField>
The above code for the DropDownList works fine on my insert page. The template field above exists in a DetailsView control, which used a PageDataSource for binding.
Any ideas on how to get this working?