Search code examples
sqlradiobuttonlistselectedvalue

'RadioButtonList' has a SelectedValue which is invalid because it does not exist in the list of items


I've a RadioButtonList looks like this:

<asp:RadioButtonList 
    ID="rblAgenda" 
    SelectedValue = '<%# Bind("bitAgenda") %>'
    runat="server" 
    RepeatDirection="Horizontal">
    <asp:ListItem Value="1">Yes</asp:ListItem>
    <asp:ListItem Value="0">No</asp:ListItem>
</asp:RadioButtonList>

This is inside a formview which is bound to a sqlDataSource. I checked the stored procedure it is returning 1 for bitAgenda, but I'm still getting this error message:

'rblAgenda' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value 

It's driving me crazy >:( Any Idea??? Btw bitAgenda is a bit Field in database, is that what causing the problem?


Solution

  • Try changing your ListItem values from 1 and 0 to true and false respectively.