I tried this way, but the button does not appear even though the items are larger than 0.
How can I do this?
CodePudding user response:
It's not enough to set it to false
if you don't want it to show. You also need to set it to true
when you want to see it again. But you can write one line that does both:
btnRemoveToCart.Visible = (lbxCart.Items.Count > 0);
Now we also no longer need the if()
check.
CodePudding user response:
Try add
else
{
btnRemoveToCart.Visible = true;
}