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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:36:45+00:00 2026-06-16T16:36:45+00:00

I have an UpdatePanel with a DropDownList. Within the UpdatePanel I am adding some

  • 0

I have an UpdatePanel with a DropDownList. Within the UpdatePanel I am adding some custom controls to a PlaceHolder which have a button in with OnClick="AddItemToCart". If I refresh my page and press the button the AddItemToCart event is called, if I change the DropDownList to something other than the default value loaded with the page then the AddItemToCart event doesn’t fire. I am able to change the DropDownList back to the default value and it will allow the event to trigger again.

I assume this is something to do with event registration but I am not sure where to look. I have tried programatically assigning the OnClick value to the button on each postback but that doesn’t seem to work. I don’t understand what is going wrong because the postback is working, my event however is not triggered.

To summarise, my OnClick doesn’t fire after the ajax postback IF the dropdown value differs from the value it loaded on the page load.

This is my code (although I am not sure it will help):

<asp:UpdatePanel ID="updSIListCnt" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:DropDownList id="ddlSort" runat="server" OnSelectedIndexChanged="ApplyFilters" AutoPostBack="True" Width="23%">
            <asp:ListItem Value="0">Sort By Relevancy</asp:listitem>
            <asp:ListItem Value="1">Sort By Product Code</asp:listitem>
            <asp:ListItem Value="2">Sort By Product Description</asp:listitem>
            <asp:ListItem Value="3">Sort By Price - Lowest</asp:listitem>
            <asp:ListItem Value="4">Sort By Price - Highest</asp:listitem>
        </asp:DropDownList>

        <asp:PlaceHolder id="phContentListCnt" runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="upSIList" runat="server" AssociatedUpdatePanelID="updSIListCnt">
    <ProgressTemplate>
        <asp:Image id="imgLoading" runat="server" ImageUrl="~/Images/loading.gif" CssClass="loader" />
    </ProgressTemplate>
</asp:UpdateProgress>

phContentListCnt contains several instances of:

 <asp:ImageButton ID="btnAddToBasket" runat="server" ImageUrl="~/Images/Buttons/add_to_basket.jpg" OnClick="AddItemToCart" CausesValidation="false" />

ApplyFilters runs some SQL and calls UpdatePanel.Refresh()

  • 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-16T16:36:46+00:00Added an answer on June 16, 2026 at 4:36 pm

    I managed to find the cause of this problem.

    In ApplyFilters I was reloading the controls and adding them to phContentListCnt but I was clearing the place holder first. This meant that the events registered in Page_Load were cleared as well and it was to late in the page life cycle at this point to register the new events. On this note, I am checking my filters in page load using Request.Form[] so I can load my dynamic controls in the page load.

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

Sidebar

Related Questions

I have an updatepanel which after clicking one button is submitting the page. The
I have an updatepanel in ASP.NET that does a partial page refresh. I've had
I have a UpdatePanel with a PlaceHold contained in it. I create some controls
I have a Content Page with drop down lists within an update panel: <asp:UpdatePanel
I have an UpdatePanel with ContentTemplate specified. When page loads, user can do some
I have a gridview which contains controls like checkbox dropdownlist textbox etc.. These controls
I have a page witch builds lots of updatepanel with controls in them on
Q: I have a RequiredFieldValidator on my page ,when i click the button which
I have an UpdatePanel which I am using to replace the content inside of
I have an UpdatePanel which has a Repeater inside it, and inside of the

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.