store values of gridview rows and use it in session

I have a list of products in gridview.In gridview there is check box for each row. Each row contains Car Name, Car Price.I am accessing carid value thru DataKeys property.What I want is[*]when user clicks on Book button I want to store each row values insomething which I don't know how and use each row values to bedisplayed for particular user on another page.[*]I am thinking it analogous to shopping cart but I want onlyselected values and there is no such thing as quantity.[*]I want to do this using session.Somehow I want to store the list insession variable so that row values which are selected earlier canbe used to update database.Any help is appreciated.This is what I have done so far\[code\]protected void btnbook_Click(object sender, EventArgs e){ int id = 0; foreach (GridViewRow gvrow in gvcar.Rows) { if (((CheckBox)gvrow.FindControl("chkSelect")).Checked == true) { var dataKey = gvcar.DataKeys[gvrow.RowIndex]; if (dataKey != null) Response.Write((string) ("ID:"+dataKey.Value+"Name of Car"+gvrow.Cells[1].Text)); } else { MessageBox.Show("Please select a car"); } } }\[/code\]
 
Back
Top