comfortablynumb — 2011-06-30T12:00:07-04:00 — #1
I'm really new to ASP.Net C# and I've got a problem using PostBackURL
I have a shopping cart. The cart contents is database driven. When the user wants to click continue to purchase the items in the cart, I need to pass the cartID to the next page (order.aspx). However, I also need to recalculate the cart contents to ensure no quantities have been altered.
So I really need an onclick function to call the recalcCart function and then use PostBackURL (or equivalent). I can't seem to find a way to do it.
I don't want to use querystring or server.transfer (want to a move to the next page)
Any help would be greatly appreciated.
PS this would have been easy in classic ASP!!! :rofl:
sirge — 2011-07-02T22:23:08-04:00 — #2
What if, you make of a class file and create your function in that class file. Aside from that, declare a parameter by reference of your control. And on the control's click event, invoke the function that you made in order for you to recalculate the content of the cart.
webcosmo — 2011-07-04T00:14:20-04:00 — #3
one way of doing it would be putting them on a session variable. then you can access it from any page.
wwb_99 — 2011-07-04T15:20:33-04:00 — #4
But what if the user has 2 pages open with 2 different carts? Sessions are nasty race conditions at times.
Personally, I would use a standard postback here and then just forward the user to the appropriate page assuming everything checks out.
flash_map — 2011-07-08T15:54:04-04:00 — #5
i think create a parent class inherit with page classes. then simply recalculate and transfer link to next page
williamjerry — 2011-07-13T23:43:22-04:00 — #6
You can store them in a table and fetch in next page from DB.
karan_digital — 2011-07-15T16:32:24-04:00 — #7
you can use a query to take your variables to the next page if you don't wanna use a session