Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hai friends,

I am working under one travel(ticket booking) module that page like


no of adult:........(in drop down list)
no of child:........(in drop down list)

actually i have to calculate the total ticket price based upon the those two drop down list values which entered by user..then & there only i have to display the total ticket price....i want source code for this task....please help me to find the solution for this task.



Thanks,
With Regards,
Vidhya.S
Posted
Comments
Tamil Selvan K 5-Jul-12 9:39am    
Is it winform or what? can you elablorate your difficulty.. we can see the same question of yours here http://www.codeproject.com/Questions/416193/calculating-the-numbers
Shemeer NS 5-Jul-12 9:46am    
have you done anything on this?
Do u want us to write codes for u ? Or you want the logic ?
If you can make out the logic, then go forward with coding.
If you will face any difficulty, we will definitely help you if you post your code here.... :)
[no name] 5-Jul-12 10:27am    
You have already asked this and received answers for this very simple basic operation.

1 solution

Set the default selectedindex = 0.
Here
ddlAdult is Adult dropdown id.
ddlChild is Child dropdown id.
txtTotalPrice is textbox id
C#
If(ddlAdult.SelectedIndex != 0 && ddlChild.SelectedIndex != 0)
{
          txtTotalPrice = (Convert.ToInt32(ddlAdult.SelectedValue) * adultPrice) + (Convert.ToInt32(ddlChild.SelectedValue) * childPrice);
}
 
Share this answer
 
Comments
Vidhya Sekar 6-Jul-12 0:15am    
thanks for giving solution for my task....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900