Hi All,
Having a problem getting boolean values from checkboxes on a formview grid.
I am trying to allow the user to check which roles an album can be assigned to. In the database the IsPublic, IsFamily & IsFriends columns are BIT datatype.
Checkboxes are coded as follows :-
<asp:FormView ID="FormView1" Runat="server"
DataSourceID="ObjectDataSource1" DefaultMode="Insert"
BorderWidth="0" CellPadding="0">
<InsertItemTemplate>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ErrorMessage="You must choose a title." ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" />
<p>
Title<br />
<asp:TextBox ID="TextBox1" Runat="server" Width="200" Text='<%# Bind("Caption") %>' CssClass="textfield" />
<asp:CheckBox ID="CheckBox2" Runat="server" Checked='<%# Bind("IsPublic") %>' Text="Make this album Public" />
<br />
<asp:CheckBox ID="CheckBox3" Runat="server" Checked='<%# Bind("IsFamily") %>' Text="Make this album Family" />
<br />
<asp:CheckBox ID="CheckBox4" Runat="server" Checked='<%# Bind("IsFriends") %>' Text="Make this album Friends" />
</p>
<p style="text-align:right;">
<asp:ImageButton ID="ImageButton1" Runat="server" CommandName="Insert" skinid="add"/>
</p>
</InsertItemTemplate>
</asp:FormView>Problem is that when I just click on the Public checkbox, all the columns get '1' and on the others '0' gets entered.
For this page, there is nothing in the code behind page.
I added parameters for the InsertMethod for my datasource:-
<asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager"
SelectMethod="GetAlbums" InsertMethod="AddAlbum" >
<InsertParameters>
<asp:Parameter Name="Caption" Type="String" />
<asp:Parameter Name="IsPublic" Type="Boolean" />
<asp:Parameter Name="IsFamily" Type="Boolean" />
<asp:Parameter Name="IsFriends" Type="Boolean" />
</InsertParameters>
</asp:ObjectDataSource>Can anyone see where I am going wrong....
Cheers
Dan