I am trying to create function, can add selected product_id into my cart table. I have setup following logic, in my cart button however, when I execute the button, the code executes the else statement ("error adding item to
the cart") and I cannot seem figure out why?
protected void Button2_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox cb = (CheckBox)row.FindControl("SelectedProducts");
if (cb != null && cb.Checked)
{
cb.Checked = true;
insert_port();
Label1.Text = "Data inserted into the cart";
}
else
{
Label1.Text = "error adding item to the cart";
} ...
Go to the complete details ...