Last post Jul 29, 2020 08:32 AM by XuDong Peng

• Flame103

Member

4 Points

7 Posts

### How to use price range to assign values !

Can anyone help me out about how can I add a price range and make num1 depend on price range !!

-----------------------------------------------------------------------CODE-------------------------------------------------------------------------------------

int num1 = Convert.ToInt32(Price.Text);
int num2 = Convert.ToInt32(DropDownList1.SelectedValue);
int num3 = Convert.ToInt32(DropDownList2.SelectedValue);
int tax;
//int price;

int petrol;
int cng;
int diesel;
int personal;
int commercial;

petrol = 1000;
cng = 2000;
diesel = 3000;
personal = 500;
commercial = 700;
tax = 0;
//price = 0;

if (DropDownList1.SelectedValue == "1" | DropDownList2.SelectedValue == "1" )
{
tax = num1 + petrol + personal;
}
else if (DropDownList1.SelectedValue == "2" | DropDownList2.SelectedValue == "1" )
{
tax = num1 + cng + personal;
}
else if (DropDownList1.SelectedValue == "3" | DropDownList2.SelectedValue == "1" )
{
tax = num1 + diesel + personal;
}
else
{

}

if (DropDownList1.SelectedValue == "1" | DropDownList2.SelectedValue == "2" )
{
tax = num1 + petrol + commercial;
}
else if (DropDownList1.SelectedValue == "2" | DropDownList2.SelectedValue == "2" )
{
tax = num1 + cng + commercial;
}
else if (DropDownList1.SelectedValue == "3" | DropDownList2.SelectedValue == "2" )
{
tax = num1 + diesel + commercial;
}
else
{

}

CalTax.Text = tax.ToString();

-----------------------------------------------------------------------------CODE-------------------------------------------------------------------------------

• XuDong Peng

Member

610 Points

181 Posts

### Re: How to use price range to assign values !

Jul 29, 2020 08:32 AM|XuDong Peng|LINK

Hi Flame103,

I found that in this thread, some members have responded and solved your current problem.

If you have any other questions, please feel free let me know.

Best regards,

Xudong Peng