Hi. This seems like it should be easy but its driving me nuts...

I have a radio button list like so...

<asp:RadioButtonList ID="controlName" runat="server">
<asp:ListItem Value="'True'" Text="Y" />
<asp:ListItem Value="'False'" Text="N" />
</asp:RadioButtonList>

I have a SQLDataSource setup to insert this field into a microsoft sql
table. The data source line for this field is...

<asp:ControlParameter ControlID="controlName" Name="PARAM_NAME"
PropertyName="SelectedValue" Type="Boolean" />

And my param in the sql stored proc is...
@PARAM_NAME BIT

The insert keeps failing however. It is passing in "True" or "False"
to the bit param which I believe is the problem. I tried passing in
"T"/"F", "1"/"0", etc.... but can't get anything to work. I believe
what I need to pass in is a 1 or 0 (ints, not strings), however the
way I understand it is the ListItem Value can only be a string. Is
there a way to do this? Thanks!

Re: Binding RadioButtonList to a SQL bit column through SQLDataSource by mbosco51

mbosco51
Tue Apr 29 13:10:20 CDT 2008

On Apr 28, 5:17=A0pm, mbosc...@hotmail.com wrote:
> Hi. =A0This seems like it should be easy but its driving me nuts...
>
> I have a radio button list like so...
>
> <asp:RadioButtonList ID=3D"controlName" runat=3D"server">
> =A0 =A0 <asp:ListItem Value=3D"'True'" Text=3D"Y" />
> =A0 =A0 <asp:ListItem Value=3D"'False'" Text=3D"N" />
> </asp:RadioButtonList>
>
> I have a SQLDataSource setup to insert this field into a microsoft sql
> table. =A0The data source line for this field is...
>
> <asp:ControlParameter ControlID=3D"controlName" Name=3D"PARAM_NAME"
> PropertyName=3D"SelectedValue" Type=3D"Boolean" />
>
> And my param in the sql stored proc is...
> @PARAM_NAME =A0 =A0 BIT
>
> The insert keeps failing however. =A0It is passing in "True" or "False"
> to the bit param which I believe is the problem. =A0I tried passing in
> "T"/"F", "1"/"0", etc.... but can't get anything to work. =A0I believe
> what I need to pass in is a 1 or 0 (ints, not strings), however the
> way I understand it is the ListItem Value can only be a string. =A0Is
> there a way to do this? =A0Thanks!

Nevermind, sorry. I had another problem elsewhere in my
SQLDataSource. Once I fixed that and went back to this issue, I
realized what I had originally was correct all along. Passing in True
or False is fine. Thanks.