PC Review


Reply
Thread Tools Rate Thread

Binding RadioButtonList to a SQL bit column through SQLDataSource

 
 
mbosco51@hotmail.com
Guest
Posts: n/a
 
      28th Apr 2008
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
 
 
 
 
mbosco51@hotmail.com
Guest
Posts: n/a
 
      29th Apr 2008
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FormView - RadioButtonList binding =?Utf-8?B?VGlt?= Microsoft ASP .NET 2 28th Apr 2006 06:17 PM
SqlDataSource not binding Mike T Microsoft ASP .NET 3 2nd Feb 2006 09:27 PM
Data Binding a Bit Column to RadioButtonList Michael Microsoft ASP .NET 1 2nd Jan 2004 08:15 PM
binding data to a radiobuttonlist within an ItemTemplate ani Microsoft ASP .NET 0 30th Oct 2003 10:11 PM
Binding RadioButtonList ... Ivan Demkovitch Microsoft ASP .NET 2 19th Aug 2003 04:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:21 AM.