Chauffeur service cost $30. It is an option to user whether they want the service or not. When they already select car, and day of rental, I store it in session.
Store the dropdown value into another session variable say IsChaffeurUsed. Make it a boolean.
bool IsChauffeurUsed= dropDown.SelectedValue=="Yes" ? true :false;
Session["IsChauffeurUsed"]= IsChauffeurUsed;
//Your logic to compute total
int totalValue = 0;
totalValue = int.Parse(Session["price"].ToString()) *
int.Parse(Session["day"].ToString());
//check if chaffeur service is used
bool isChaffeurUsed = (bool) Session["IsChaffeurUsed"];
if(isChaffeurUsed)
{
total += 30;
}
Label8.Text = (totalValue).ToString();
totalValue = int.Parse(Session["price"].ToString()) * int.Parse(Session["day"].ToString()) + ShowFerInUse ? 30 : 0;
This way you can use iif equivalent in c# and do ShowFerInUse at same time.
Why don't you create a custom class, add the properties like Car, Price, Day, ChaffterUsed etc. Create the object of the class, fill the properties and store the object into session. On next page, load the object from session and use it.
I suggest use Server.Transfer() instead of Response.Redirect() and use PreviousPage to fetch your required values.
This will save you from using Session as Session should not be used in this scenario.
To know how to use PreviousPage see below link.
http://msdn.microsoft.com/en-us/library/system.web.ui.page.previouspage.aspx
When you provide to select the service in a dropdown, why not store that status in session as well ? Like
bool chauffeurService= YourServiceDropDown.SelectedValue=="1" ? true :false;
Session["chauffeurStatus"]=chauffeurService;
Then inside your form where to process values
// Check if Chauffer service status is 1 add 30 dollars else don't add anything