Oh, I see. In my RadioButtonList I was using 0 and 1 as values; because of this it was not working with bit: I actually trying to check if True = 1 (the integer). Thanks a lot for the help guys. Very useful :)
On Sep 13, 9:08 am, TheWall <[email protected]> wrote: > I have noticed that when you send a bit value to a page, it will > recognize 1 as TRUE and 0 as FALSE. In other words the page does not > understand bit as 1 & 0, but as TRUE and FALSE. > > You can also manipulate the bit with SQL SELECT such as CONVERT > (nvarchar (3),ISNULL(bit_field, 'No')). Of course the addparameter on > the page will then have to accept nvarchar (3) and if statements will > have to be adjusted accordingly. > > One other option on the page would be (remembering the page sees bit > as TRUE or FALSE): > > If bit_field = "True" Then MemberRadioButtonList.SelectedValue = > "yes" > > ElseIf bit_field = "False" Then MemberRadioButtonList.SelectedValue = > "no" > > End If > > Hope this helps! > > On Sep 11, 9:38 am, Ana <[email protected]> wrote: > > > Hi, > > > I have a formview and, inside it, I have an ItemTemplate, an > > InsertItemTemplate and an Edit ItemTemplate. In the InsertItemTemplate > > and the EditItemTemplate, I have a RadioButtonList with two options > > (Yes or No) and this list is bound with the information retrieved from > > the Database. > > The InsertTemplate is not a problem, because I'm specifying a default > > value. But for the Edit ItemTemplate an error message is fired when > > the value in the Database is null. My code is like this: > > > ------------------------- > > <tr> > > <td align="right"> > > <b> Member: </b> > > </td> > > <td align="left"> > > <asp:RadioButtonList ID="MemberRadioButtonList" > > runat="server" AutoPostBack="False" > > SelectedValue='<%# Bind("isMember")%>'> > > <asp:ListItem Text="Yes" Value="1"></asp:ListItem> > > <asp:ListItem Text="No" Value="0" ></asp:ListItem> > > </asp:RadioButtonList> > > </td> > > </tr> > > ------------------------- > > > How do I handle with the nulls in this case? > > > Thanks a lot! > > > Ana
