• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

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

i am using formview,
i just copied the controls which was working fine in the inserttemplate to edit template..

now i am getting this error
'RadioButtonList_qtyuom' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value




     <asp:RadioButtonList ID="RadioButtonList_qtyuom" runat="server" CellPadding="2"
                                                        CellSpacing="2" Height="15px" RepeatDirection="Horizontal"
                                                        SelectedValue='<%# Bind("quantity_uom") %>' Width="298px">
                                                        <asp:ListItem Value="D">Drum</asp:ListItem>
                                                        <asp:ListItem Value="T">Tons</asp:ListItem>
                                                        <asp:ListItem Value="Y">Yards</asp:ListItem>
                                                        <asp:ListItem Value="G">Gallons</asp:ListItem>
                                                    </asp:RadioButtonList>

can you help
0
eoswin
Asked:
eoswin
  • 2
  • 2
1 Solution
 
rawinnlnx9Commented:
What you have looks right. What type of field is 'quantity_uom' can it be null? If so then you need a null item in your list that is hidden.

See this: http://stackoverflow.com/questions/1050794/databinding-of-radiobuttonlist-using-selectedvalue-possible
0
 
joshbulaCommented:
Whatever the database field "quantity_uom" is returning in the item being edited is not one of the values: D, T, Y, G.  It might be a null or empty value coming from the database, in which case doing an ISNULL on the query might help:  ISNULL(quantity_uom, -1) AS quantity_uom ...
0
 
eoswinAuthor Commented:
thanks the solution works fine..

 the type is char(1) null..

would you pls showing me how to add  a HIDDEN ListItem  value in my code ..  

 
0
 
eoswinAuthor Commented:
i did not notice it was in the link..  thanks
0
 
rawinnlnx9Commented:
This is it with display: none

 <asp:ListItem Value="" Text="" style="display: none" />
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now