PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Binding RadioButtonList to a SQL bit column through SQLDataSource

Reply

Binding RadioButtonList to a SQL bit column through SQLDataSource

 
Thread Tools Rate Thread
Old 28-04-2008, 10:17 PM   #1
mbosco51@hotmail.com
Guest
 
Posts: n/a
Default Binding RadioButtonList to a SQL bit column through SQLDataSource


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!
  Reply With Quote
Old 29-04-2008, 07:10 PM   #2
mbosco51@hotmail.com
Guest
 
Posts: n/a
Default Re: Binding RadioButtonList to a SQL bit column through SQLDataSource

On Apr 28, 5:17*pm, mbosc...@hotmail.com wrote:
> 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.
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off