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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:33:30+00:00 2026-06-11T04:33:30+00:00

so my problem is fairly simple i have 2 list-boxes and one button. when

  • 0

so my problem is fairly simple i have 2 list-boxes and one button.
when an item is selected in listbox2 and the button is clicked i would like to add the selected item to listbox1.

And it all seams to work until I add the second item. then listbox1 doesn’t refresh it’s items…

<body>
<form id="form1" runat="server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
            <asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ListBox2.Items.Add(new ListItem("1", "1"));
            ListBox2.Items.Add(new ListItem("2", "2"));
            ListBox2.Items.Add(new ListItem("3", "3"));
            ListBox2.Items.Add(new ListItem("4", "4"));
            ListBox2.Items.Add(new ListItem("5", "5"));
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (ListBox2.SelectedIndex != -1)
        {
            ListBox1.Items.Add(ListBox2.SelectedItem);
        }
    }
}
  • 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-06-11T04:33:31+00:00Added an answer on June 11, 2026 at 4:33 am

    You can add UpdateMode=conditional to your UpdatePanel

    And set <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />

      <asp:ScriptManager runat="server"></asp:ScriptManager>
        <div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
                    <asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                </ContentTemplate>
    
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                </Triggers>
    
            </asp:UpdatePanel>
        </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is fairly simple. I have table sets that store product sets (more
I am having a problem with what should be a fairly simple (I would
My problem in fairly simple. I have a login system constructed using php, mysql
So my problem is fairly simple. When I started to develop my website my
I think it is a fairly simple problem, but I just cant wrap my
My problem ought to be fairly simple and is more a question of interest
This is a fairly common problem to which I have yet to find an
I am fairly new to PHP OOP, the problem that I am have is
This seems like a fairly simple issue, however I could not find any straight
I have this fairly simple function to compute the mean of elements of a

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.