I am using session variables to save the data and the table, users, etc. (Then they travel to another page) and then I have the dilemma that I can not solve what steps to follow to make the summation of the Total label. I'm practically new with c # asp.net and I do not know much about coding. Thanks for any help.
Code that I used in the session of the table if it could be integrated (maybe take the data of the cell quantity while creating and multiplying, although I do not know what code would be in that case?)
if(Session["Dt"] == null)
{
DataTable Dt = new DataTable();
Dt.Columns.Add("Sandwich");
Dt.Columns.Add("Agregado");
Dt.Columns.Add("Cantidad");
Dt.Rows.Add(lista_sandwich.SelectedItem.Text, lista_agregado.SelectedItem.Text, caja_cantidad.Text); //Toma los campos del sandwich/agregado/cantidad (sus nombres y los une al row)
tablita.DataSource = Dt;
tablita.DataBind();
Session["Dt"] = Dt;
Session["cantidad"] = caja_cantidad.Text;
label_suma.Text = Session["cantidad"].ToString();
}
else
{
DataTable Dt = Session["Dt"] as DataTable;
Dt.Rows.Add(lista_sandwich.SelectedItem.Text, lista_agregado.SelectedItem.Text, caja_cantidad.Text); //Toma los campos del sandwich/agregado/cantidad (sus nombres y los une al row)
tablita.DataSource = Dt;
tablita.DataBind();
Session["Dt"] = Dt;