I have an increment and decrement button to all users to record against 4 different options (how many times this option has been done) So they choose the options from a drop down menu and then the panel appears that the two buttons are sitting within. It starts with the text for the count starting at "None" when it increments it goes up to 1, 2 so on. When it decrements its goes 2, 1, 0, -1 etc instead of "None", the way the code is suppsoed to work is if the count for that option is 0 then the decrement button doesn't appear.

This is the if statement I was using

 if (ddlAdvertType.SelectedValue != "0")
                {
                    pnlOccurrances.Visible = true;


                    if (lblAdvertOccurrances.Text == "None")
                    {
                        imgBtnDecrementOccur.Visible = false;
                    }
                    else
                    {
                        imgBtnDecrementOccur.Visible = true;
                    }
                }

                else
                {
                    pnlOccurrances.Visible = false;
                }

So it isn't working properly, any ideas?

do you enable autopostback on your dropdownlist?

I got it figured out. Created another method that checked the count to display the button.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.