SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question C# PostBackURL in Code behind?

    Hi All,

    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.

    Regs,
    ComfortablyNumb

    PS this would have been easy in classic ASP!!!

  2. #2
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Wizard webcosmo's Avatar
    Join Date
    Oct 2007
    Location
    Boston, MA
    Posts
    1,480
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    one way of doing it would be putting them on a session variable. then you can access it from any page.

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,637
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think create a parent class inherit with page classes. then simply recalculate and transfer link to next page
    http://www.fla-shop.com - Interactive maps for websites
    Flash Maps for web developers

  6. #6
    SitePoint Member williamjerry's Avatar
    Join Date
    Jul 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can store them in a table and fetch in next page from DB.

  7. #7
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use a query to take your variables to the next page if you don't wanna use a session


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •