Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1082173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:15:47+00:00 2026-05-16T22:15:47+00:00

I have a page that has two drop down lists on it and a

  • 0

I have a page that has two drop down lists on it and a button. All controls sit in an update panel. The first drop down list (ddl1) contains a lot of values which caused a huge viewstate so I disabled viewstate on it. In the page oninit event I populate the drop down list every time the page is posted back. This all seems to work fine, it shows all the values and I can access the selected value in my event handler.

ddl1 has the autopostback attribute set to true so when its value changes the second drop down list (ddl2) is populated with some values that depend on the selection in ddl1. This also works fine, the values in ddl2 change when I select a value in ddl1.

ddl2 does not have viewstate disabled. The button that sits under my two drop down lists is disabled by default and becomes enabled when the value of ddl2 is changed to anything except string.empty. This is where I run into problems. ddl2 does an autopostback too but it seems to lose the selected index/value. When I’m in my code to check whether to enable or disable the button the selected index is always 0 and the selected value is string.Empty.

If I enable viewstate on ddl1 this all works fine. Could anyone point me to what I’m doing wrong?

Here is the code executed by the ddl2 postback:

protected void AvailableProgramsIndexChanged(object sender, EventArgs e)
{
   ToggleMoreInformationButton();
}

private void ToggleMoreInformationButton()
{
        if (Request.Browser.Type.Contains("IE"))
        {
            ToggleIE();
        }
        else
        {
            ToggleNonIE();
        }
}

private void ToggleIE()
{
        if (this.ddlAvailablePrograms.SelectedValue != string.Empty)
        {
            this.careerInfoLearnMoreSubmit.Enabled = true;
            this.careerInfoLearnMoreSubmit.CssClass = "submit nongreyed";
        }
        else
        {
            this.careerInfoLearnMoreSubmit.Enabled = false;
            this.careerInfoLearnMoreSubmit.CssClass = "submit greyed";
        }
    }

private void ToggleNonIE()
{
        if (this.ddlAvailablePrograms.SelectedValue != string.Empty)
        {
            this.careerInfoLearnMoreSubmit.Enabled = true;
            this.careerInfoLearnMoreSubmit.Style.Remove("opacity");
            this.careerInfoLearnMoreSubmit.Style.Add("opacity", "1.0;");
        }
        else
        {
            this.careerInfoLearnMoreSubmit.Enabled = false;
            this.careerInfoLearnMoreSubmit.Style.Remove("opacity");
            this.careerInfoLearnMoreSubmit.Style.Add("opacity", "0.5;");
        }
 }

The code does not modify the selected value of ddl2 at all.

Thanks,
b3n

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:15:48+00:00Added an answer on May 16, 2026 at 10:15 pm

    I’m guessing the code running during the postback is clearing out ddl2 because the selected value is not coming back (because ViewState is off). But without some sample code, it’s really hard to say for sure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have JSF page has two drop down lists and I want to load
We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a
I have a set of drop down controls on a view that are linked
I have a page that contains an element (a TextBox) that has two CSS
I have a page that has an iframe From one of the pages within
I have a Page that has a single instance of a UserControl that itself
In a web application, I have a page that contains a DIV that has
I have a login page that has several textboxes on the page, one of
On my C# asp.net webform I have a search page that has roughly 20
I have an XHTML strict page that has an invisible div that is controlled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.