PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Binding RadioButtonList to a SQL bit column through SQLDataSource
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Binding RadioButtonList to a SQL bit column through SQLDataSource
![]() |
Binding RadioButtonList to a SQL bit column through SQLDataSource |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

