Hello all. I am using a SQL Server database to store my information and I am displaying my information using a detailsview. In one of the fields I use a literal to display information and I want to use a drop down list to edit information. When I run my program it displays the info correctly but when I try editing my field I get an error because I have a null value in that field. How do I get around this problem? I want to use my drop down list to update the field and add a value. <asp:TemplateField HeaderText="Rank" SortExpression="RankID"> <ItemTemplate> <asp:Literal ID="litRanks" runat="server" Text='<%# Eval("RankName") %>'></asp:Literal> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="lstAddUpRanks" runat="server" DataSourceID="SqlDataSourceAddUpRanks" DataTextField="RankName" DataValueField="RankID" SelectedValue='<%#Bind("RankID") %>'> </asp:DropDownList> 'lstAddUpRanks' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value
<asp:TemplateField HeaderText="Rank" SortExpression="RankID">
<ItemTemplate>
<asp:Literal ID="litRanks" runat="server" Text='<%# Eval("RankName") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="lstAddUpRanks" runat="server" DataSourceID="SqlDataSourceAddUpRanks" DataTextField="RankName" DataValueField="RankID" SelectedValue='<%#Bind("RankID") %>'>
</asp:DropDownList>