Yeah i could pass it as Boolean but wouldn't i have to have the value of
the checkBox checked?And if i assign CheckBox1.Checked to the value it
says its not a member of Boolean.
Any way let me explain my scenario in details :-
I have CheckBox in my webform with a Datalist like so-
<table width="300" border="0">
<tr>
<td>
<asp:CheckBox ID="MessageBank" Runat="server"></asp:CheckBox>
</td>
</tr>
</table>
<asp:datalist id="MyList" runat="server" RepeatColumns="2">
<ItemTemplate>
<td width="100" valign="middle" align="right">
<a href='ProductDetails.aspx?productID=<%#
DataBinder.Eval(Container.DataItem, "ProductID") %>'>
<img src='ProductImages/thumbs/<%#
DataBinder.Eval(Container.DataItem, "ProductImage") %>' width="100"
height="75" border="0">
</a>
</td>
<td width="200" valign="middle">
href='ProductDetails.aspx?productID=<%#
DataBinder.Eval(Container.DataItem, "ProductID") %>'>
<span class="ProductListHead">
<%# DataBinder.Eval(Container.DataItem, "ModelName") %>
</span><br>
</a>
<a href='AddToCart.aspx?productID=<%#
DataBinder.Eval(Container.DataItem, "ProductID") %>'>
<font color="#9D0000"><b>Add To Cart<b></font></span>
</a></td>
</tr>
</table>
</ItemTemplate>
</asp:datalist>
The Datalist displays products that would be added to a Cart by
clicking the AddToCart.aspx with the ProductID link above.But i want the
user to select the checkbox and would like to pass the value to
AddToCart page.
In AddToCart.aspx codebhind i call a Public Method called AddProduct
that inserts the Products
cart.AddProduct(cartId, CInt(Request.Params("ProductID")), 1,
MessageBank)
Below is the Method in the Class that inserts the products
----------------------------------------------------------
Public Sub AddProduct(ByVal cartID As String, ByVal productID As
Integer, ByVal quantity As Integer, ByVal MessageBank As Boolean)
Dim parameterMessageBank As SqlParameter = New
SqlParameter("@MessageBank", SqlDbType.Bit)
parameterMessageBank.Value = MessageBank
myCommand.Parameters.Add(parameterMessageBank)
My Question is how would i pass the selected checkBox(MessageBank) to
the AddProduct and i want to insert 1 or 0 to the MessageBank field so
if checked it inserts 1 and if not 0.
Thanks