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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:59:44+00:00 2026-05-13T07:59:44+00:00

I’ve got a .aspx and in it an .ascx. In the .ascx I have

  • 0

I’ve got a .aspx and in it an .ascx. In the .ascx I have a server control.

The .aspx has a list of items in a cart
The .ascx has a list of some cross-sell items (fed from a custom server control) that the customer can add to the cart if desired

both the list of items in cart and list of cross sell items are driven by a repeater and bound on page load. So the .aspx calls a method that rebinds the cart items on page load. And the .ascx calls a method in its page load that rebinds the cross sell items in that custom control (.cs) that is in my .ascx.

The problem I have is, when the user clicks a “add to cart” button in the repeater inside my custom control, the page refreshes and what should happen is the cart items in the .aspx AND the list of cross sells should refrsh showing that the cross sell item was moved to the cart. But even though when I debug and I see the list being rebound with the corret # of items after the move, the page still shows the old state. I have to refresh the page manually again to get it to work.

I guess I need to check for Page.IsPostback? but even if I don’t check that..at the least both lists should be refreshing regardless cause I have it in my page load. So even if it’s a postback, and I’m not checking for that the lists should show the new state because I’m not even checking for postback anyway. So checking for postaback I don’t think is the issue here cause i want the lists to rebind and re-update on any page load….initial or if it’s a postback…it doesn’t matter. Reload every time. But it doesn’t seem to be doing this even though I clearly see the revbind of the lists having the right count (one less on the cross sell and one additional to the cart as it was added after the user clicked the button).

So lets recap again. Here’s the sequence of events:

  1. User is on their cart page
  2. User sees a list of cart items that they have added to their cart already (this list is bound in the Cart.aspx and rebound on every page load)
  3. User sees a list of possible cross sell items they can add to their cart somewhere on the page. This list is a custom control found in my .ascx and that .ascx is obviously in my .aspx. The custom control is just a repeater that lists out the cross sell items
  4. User clicks one of the “Add to cart” buttons on one of the cross sells
  5. Page refreshes. In the page load of the .aspx AND the .ascx, I am going out to the DB and rebinding both those lists based on the new state…that is, the new lists after the item was added to the cart which means that now the cart items should have one more added to the list and it does…I clearly see that the new list has one more.
  6. The page comes back after the refresh but I don’t see the lists reflecting the new state…I don’t see the new item in the cart items list and the added cross sell removed from the cross sell list even though again both lists when I debug are showing correct set of records reflecting the new state

so I’m lost here as to why this is not showing me the updated results.

  • 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-13T07:59:45+00:00Added an answer on May 13, 2026 at 7:59 am

    The problem is, that the eventhandler for the “add to cart” button is called after the page_load. That means that the old items are bound.

    The solution would be to manually force a .DataBind() in the eventhandler.

    Nevertheless, I would recommend to stay at

    if(!Page.IsPostBack)  
    {  
       // bind cart
    }  
    

    in the Page_Load to avoid multiple binds.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.