Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FormView binding to boolean property

Reply
Thread Tools

FormView binding to boolean property

 
 
Steve Richter
Guest
Posts: n/a
 
      11-23-2008
working from Dino Esposito's book on asp.net 3.5, he has a great example of a
FormView binding to the selected row of a GridView.

my "GetVendor" method returns a class that contains Vendor properties. One
of the properties is a boolean that indicates if the drop ship vendor is
currently shipping the items in a catalog.

How do I bind that boolean property to a RadioButton or RadioButtonList with
a "yes" button and a "no" button? The first problem is getting the "no"
button to be on when the boolean is false. My class has an "IsShipping"
property. I created a 2nd property called "IsNotShipping" that the "no"
button binds to. Is there a better way?

thanks,


<asp:ObjectDataSource id="RowDataSource" runat="server"
SelectMethod="GetVendor" TypeName="Data_Vendors" >
<SelectParameters>
<asp:ControlParameter Name="FactCode" ControlID="GridView2"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:ObjectDataSource>

<asp:FormView ID="FormView1" runat="server"
DataKeyNames="FactCode" DataSourceID="RowDataSource" >

<ItemTemplate>
<table style="border:solid 1px black;" width="100%">

<tr>
<td bgcolor="yellow" width="50px" align="center">
<b>Is shipping</b>
</td>
<td bgcolor="lightyellow" >

<asp:RadioButton ID="shippingYes" GroupName="IsShip" Text="Yes"
Checked='<%# Bind("IsShipping") %>' runat="server"/>
<asp:RadioButton ID="shippingNo" GroupName="IsShip" Text="No"
Checked='<%# Bind("IsNotShipping") %>' runat="server"/>

</td>
</tr> </table>
</ItemTemplate>
</asp:FormView>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Subtle difference between boolean value and boolean comparison? Metre Meter Javascript 7 08-06-2010 08:40 PM
difference between 'boolean' and 'java.lang.Boolean' J Leonard Java 4 01-19-2008 02:56 AM
Formview within Formview Chris ASP .Net 0 05-19-2007 04:12 PM
Binding to property of property of object collection TS ASP .Net 3 08-31-2006 12:57 PM
Error when data binding to repeater "... is not a valid value for Boolean" Alan Silver ASP .Net 6 07-13-2005 02:48 PM



Advertisments