I have a page that allows a user to enter a reference then select the app that they want. The reference is stored as session and is used on other pages to show the user their recording against that reference. On this particular page (after they have chosen the app) the user selects from a drop down list then can increment, decrement a count against the option.

The problem i'm having is if it's an application ref that I tested previously it works. But when I test with a new application ref it doesn't do anything.

This is the if statement I am using for the if statement

  protected void ddlAdvert_SelectedIndexChanged(object sender, EventArgs e)
        {  
            if (Session["SessRef"] != null)
            {
                if (ddlAdvert.SelectedValue != "0")
                {
                    pnlButtons.Visible = true;
                }

                else
                {
                    pnlButtons.Visible = false;
                }

                //validate page before proceeding
                Page.Validate();

                if (Page.IsValid)
                {
                    labelOccurrances.Text = CountAdverts();

                    //set button visiblity
                    setbtnVisible(labelOccurrances.Text);
                }
            }
            else
            {
                Response.Redirect("~/Search.aspx");
            }
        }

When I run the code through debug and I hover over (ddlAdvertType.SelecteValue != "0") it displays the number that goes against the option i choose in the drop down, so this is right. When I hover over pnlButtons.Visible = true; it shows as false. So my panel is not showing. No idea what's going on here, any suggestions?

Problem was to do with an if statement elsewhere in the code

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.