Click here to Skip to main content
16,011,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to let me get the Total Price from the bus ticket? Waste 1 week, I still can't get the idea...
C#
protected void btnBookSeat_Click(object sender, EventArgs e)
    {

        if (Session["basket"] != null)
        {
            Basket_DataTable = (DataTable)Session["basket"];
            Basket_DataTable.Rows.Add(new object[] { ddlFromCity.Text, lblPrice.Text, txtJdate.Text, cblTime.Text, ddlSeat.Text });

            Session["basket"] = Basket_DataTable;
            GridView1.DataSource = Basket_DataTable;

            GridView1.DataBind();

        }
        else
        {
            //create an empty DataTable and Add some columns to it
            Basket_DataTable = new DataTable();
            Basket_DataTable.Columns.Add("BusRouteID", typeof(string));
            Basket_DataTable.Columns.Add("Price", typeof(double));
            Basket_DataTable.Columns.Add("Date", typeof(string));
            Basket_DataTable.Columns.Add("Time", typeof(string));
            Basket_DataTable.Columns.Add("SeatNo", typeof(string));
            Basket_DataTable.Columns.Add("Total", typeof(string));
            Basket_DataTable.Rows.Add(new object[] { ddlFromCity.Text, lblPrice.Text, txtJdate.Text, cblTime.Text, ddlSeat.Text, });

            Session["basket"] = Basket_DataTable;

            GridView1.DataSource = Basket_DataTable;
            GridView1.DataBind();

                    }
    }
Posted
Updated 19-Dec-13 1:14am
v2
Comments
Member 10434230 19-Dec-13 7:19am    
where are you calculating the fare?
Tejas Vaishnav 19-Dec-13 7:22am    
means you want to display over all total of your bus ticket?
Not clear.
BK 4 code 19-Dec-13 7:39am    
Please ellaborate your question , and show your code to calculate total

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