joker77 Posted May 25, 2007 Posted May 25, 2007 Hi, I'm 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: <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> I've 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? Quote What if the Hokey-Pokey IS what it's all about?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.