Binding RadioButtonList to a SQL bit column through SQLDataSource

M

mbosco51

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!
 
M

mbosco51

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!

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top