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

  • Home
  • SEARCH
  • 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 7662125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:43:19+00:00 2026-05-31T13:43:19+00:00

Using: .NET 3.5SP1, VS2008 I was editting someone else asp.net script, he did the

  • 0

Using: .NET 3.5SP1, VS2008

I was editting someone else asp.net script, he did the Data retreving at the Page_Load while Page is not postback.

I could see the data was populated into the DropDownList properly even after I refresh, navigates, postback in the page.

I added couples more DropDownList and some CheckBoxes into the script, only the DropDownList I added got populated properly. But not the CheckBox.

So I do a test in a new project, which is similar to its script structure:

ASPX:

<form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
            <asp:ListItem>Item1</asp:ListItem>
            <asp:ListItem>Item2</asp:ListItem>
        </asp:DropDownList>
        <% 
            if (DropDownList1.SelectedValue == "Item2")
            {                
        %>
        <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox 1" />
        <asp:TextBox ID="TextBox1" runat="server" Text="" />
        <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true">
            <asp:ListItem>Item1</asp:ListItem>
            <asp:ListItem>Item2</asp:ListItem>
        </asp:DropDownList>
        <%
            }
        %>
    </div>
    </form>

Code-Behind:

 public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.CheckBox1.Checked = true;
                this.CheckBox1.Text = "Hello CheckBox";
                this.TextBox1.Text = "Hello TextBox";
                this.DropDownList2.SelectedValue = "Item2";
            }
        }
    }

So as you see the code, when the page first load, the CheckBox1‘s text will change, Checked will be true, so as other TextBox and DropDownList2

After I select DropDownList1‘s item to Item2, when the CheckBox1, TextBox1, DropDownList2 nothing got setted, except the CheckBox1.Text.

Why is this happen?

EDIT:

I tried to put them into Panel, in this way it work. But the problem is the program I am editting is using the format above.. So I am not allow to change them all to Panel.

<form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
            <asp:ListItem>Item1</asp:ListItem>
            <asp:ListItem>Item2</asp:ListItem>
        </asp:DropDownList>
        <% 
            if (DropDownList1.SelectedValue == "Item2")
            {
                this.MyPanel.Visible = true;
            }
            else
            {
                this.MyPanel.Visible = false;
            }
        %>
        <asp:Panel ID="MyPanel" runat="server" Visible="false" >
            <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox 1" />
            <asp:TextBox ID="TextBox1" runat="server" Text="" />
            <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="true">
                <asp:ListItem>Item1</asp:ListItem>
                <asp:ListItem>Item2</asp:ListItem>
            </asp:DropDownList>
        </asp:Panel>

    </div>
    </form>
  • 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-31T13:43:20+00:00Added an answer on May 31, 2026 at 1:43 pm

    Try out setting EnableViewState and ViewStateMode, perhaps some of the parent controls has disabled it so default Inherit value has been applied.

    MSDN:

    The default value of the ViewStateMode property for a Web server
    control in a page is Inherit. As a result, if you do not set this
    property at either the page or the control level, the value of the
    EnableViewState property determines view-state behavior.

    <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox 1" 
                  EnableViewState="true"
                  ViewStateMode="Enabled" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .NET 3.5 SP1 in ASP.NET MVC application. While using ObjectContext with Http
I have a website built using Asp.net and LinqToSql for Data Access. In a
I'm using the new CompositeScript feature that's available in the ASP.NET 3.5 SP1 for
I am building a asp.net webforms (3.5 sp1) application, using jquery where I can
I'm using .NET 3.5 SP1. Using VS2008 Designer, I created entity 'Category' based on
I am using .NET 3.5SP1 and DataContractSerializer to serialize a class. In SP1, they
Using vs2008 .NET 3.5 SP1 I am trying to use an ActiveX dll in
I have asp.net 3.5 sp1 installed, using vs.net 2008. Is asp.net mvc still a
Currently developing an ASP.NET WebApplication with VS2008. I stopped development for a few weeks,
I'm using ASP.NET 3.5 web forms, ASP.NET AJAX and ASP.NET AJAX Control Toolkit. I

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.