|
Written in the Click event of another Button on the page, tried it for a long time, and finally solved it, thank you:
The code is changed to the following:
String strTitle, strNum;
Hashtable hash = new Hashtable (50);
int iNum = GridView1.Rows.Count;
for (int i = 0; i <iNum; i ++)
{
CheckBox check = (CheckBox) GridView1.Rows [i] .Cells [0] .Controls [1];
if (check.Checked)
{
TextBox textQuantity = (TextBox) GridView1.Rows [i] .Cells [2] .Controls [1];
strTitle = GridView1.Rows [i] .Cells [1] .Text;
strNum = textQuantity.Text;
hash.Add (strTitle, strNum);
}
}
Session ["basket"] = hash; |
|