Please help as this is a time sensitive issue I'm having with a project. The problem is that I have a GridView and in that GridView I have one column that requires a 'YES' or 'NO' response. I'm using a dropdownlist in the EditItemTemplate to grab distinct or unique choices from the database. Everything loads and displays fine from the datasource as you can see in this picture:
When I click the edit button the fields display appropriately as well as you can see from this picture:
However, when I select either 'YES' or 'NO', and click Update; I get the following error:
Here is the snippet of my .aspx code
<asp:TemplateField HeaderText="Required" SortExpression="IsRequired">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="dsIsRequiredDDL" DataTextField="IsRequired" DataValueField="IsRequired"></asp:DropDownList>
<asp:SqlDataSource ID="dsIsRequiredDDL" runat="server" ConnectionString="<%$ ConnectionStrings:BITSDevConnectionString %>" SelectCommand="SELECT DISTINCT [IsRequired] FROM [EmpCertType]"></asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("IsRequired") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
And he is a picture of the table in my database:
For the record, all data in the database is test (fictitious) data so there are no PII concerns.
So the questions are: What is going on? Why am I getting this error? And most importantly, how do I correct this?
I've tried using a radiobuttonlist and got an error with that as well. I've tried hard coding the selections in the dropdownlist and got the same error I got here, and I've done hours and hours of research on this one problem alone.
Any and all help is greatly appreciated!