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 313843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:08:44+00:00 2026-05-12T08:08:44+00:00

In my project I have placed a dropdownlist in an updatepanel.what I wanted to

  • 0

In my project I have placed a dropdownlist in an updatepanel.what I wanted to do is to select a value from dropdownlist and use it in a session.

but whatever I do, it will always give me null value because of not checking "Enable AutoPostBack".and when I do this, it will refresh the page so this isn’t what I wanted.

  • 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-12T08:08:44+00:00Added an answer on May 12, 2026 at 8:08 am

    It sounds like you may not be using the UpdatePanel feature properly. If you have the UpdatePanel set to update when children fire events, only the UpdatePanel should refresh, not the entire page. The code below seems to behave similar to what you are seeking. When changing the drop down, only the update panel posts back to the server and when you refresh the page, you can get the value out of the session.

    ASPX CODE

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            Current Time: <asp:Label ID="lblTime" runat="server" /><br />
            Session Value: <asp:Label ID="lblSessionValue" runat="server" /><br />
            <br />
            <asp:UpdatePanel ID="upSetSession" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="ddlMyList" runat="server" 
                        onselectedindexchanged="ddlMyList_SelectedIndexChanged"
                        AutoPostBack="true">
                        <asp:ListItem>Select One</asp:ListItem>
                        <asp:ListItem>Maybe</asp:ListItem>
                        <asp:ListItem>Yes</asp:ListItem>
                    </asp:DropDownList>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddlMyList" 
                        EventName="SelectedIndexChanged" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </form>
    

    CODE BEHIND

        protected void Page_Load(object sender, EventArgs e)
        {
            this.lblTime.Text = DateTime.Now.ToShortTimeString();
            if (Session["MyValue"] != null) 
                this.lblSessionValue.Text = Session["MyValue"].ToString();
        }
    
        protected void ddlMyList_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session.Remove("MyValue");
            Session.Add("MyValue", this.ddlMyList.SelectedValue);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have placed the two bloom classes into my project from the Bloom sample
I have started working on Opencl for a project. I have wanted to use
I have an exe that is built and placed into a Setup project for
My project have no visible error but when i try to run it gives
I have project I want to upgrade to .Net4 and it use BackgroundCopyManager.dll. Anyone
I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
I am taking on a project where all the Exceptions have been placed in
I have a project with multiple targets, each building a separate app, but sharing
I'm using eclipse and I have placed log4j.properties in the project directory and I
Having issues getting django custom commands to work. From django documetation , have placed

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.