What would be the proper syntax in ASP.NEt 3.5 C# to assign a TextBox value to a temporary or session variable to be manipulated (added, subtracted, multiplied, divided) at different points in the application? I want to add a decimal number to this variable in almost every instance as well.
Session["MyValue"] = Convert.ToDecimal(textBox1.Text);
decimal myValue = Convert.ToDecimal(Session["MyValue"]);
is this what you want?
Something along the lines of:
Session["decimalnumber"] = 1 //Your value
decimal number = (decimal)Session["decimalnumber"]
This assigns 1 into a session variable - then gets it back out as an decimal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With