How to use Session variables asp.net c#
30,649
you have different names. discountedOrderTotal vs discountOrderTotal
Author by
scapegoat17
Updated on July 09, 2022Comments
-
scapegoat17 almost 2 years
I cant seem to pass my variable through to the next page. Can anyone tell me what i am doing wrong?
var finalValue = value * sqlCouponValue; finalValue = Math.Round(finalValue, 2); Session["discountedOrderTotal"] = finalValue.ToString();
where i am trying to call it again on the next page:
e.Row.Cells[4].Text = "$" + Session["discountOrderTotal"];
Does anyone have any ideas? I have never used session variables before and am not sure why it is just returning a
$
. Any help would be much appreciated. Thanks! -
Dom almost 10 yearshappens to the best of us
-
Dom almost 10 yearsi prefer to persist a class object to a session variable, that way i can utilize strongly typed properties.
-
Randy E almost 10 yearsSometimes it just takes an extra set of eyes. Make sure you're taking regular breaks, even if its just 5 minutes every 15-20 or so to refocus your eyes.