![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
trouble converting RadioButtonList.SelectedValue into a string
Hey
asp.net 2.0 When I execute my code I get an exception error saying: "String was not recognized as a valid Boolean" <asp:RadioButtonList ID="rblGender" Width="100%" RepeatDirection="Horizontal" runat="server"> <asp:ListItem Text="Male" Selected="True" Value="1" /> <asp:ListItem Text="Female" Value="0" /> </asp:RadioButtonList> It is on the second line below where the error is RadioButtonList rbl = (RadioButtonList)tblEditUser.FindControl("rblGende r"); bool gender = bool.Parse(rbl.SelectedValue); any suggestions? |
|
|||
|
Re: trouble converting RadioButtonList.SelectedValue into a string
"Jeff" <it_consultant1@hotmail.com.NOSPAM> wrote in message news:uH8A2dNKJHA.3744@TK2MSFTNGP06.phx.gbl... > Hey > > asp.net 2.0 > > When I execute my code I get an exception error saying: "String was not > recognized as a valid Boolean" > <asp:RadioButtonList ID="rblGender" Width="100%" > RepeatDirection="Horizontal" runat="server"> > <asp:ListItem Text="Male" Selected="True" Value="1" /> > <asp:ListItem Text="Female" Value="0" /> > </asp:RadioButtonList> > > It is on the second line below where the error is > RadioButtonList rbl = > (RadioButtonList)tblEditUser.FindControl("rblGende r"); > bool gender = bool.Parse(rbl.SelectedValue); > > any suggestions? Yes. "0" and "1" are not booleans! -- John Saunders | MVP - Connected System Developer |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|