>>I've tried the below code but it only produces a single check box.
It produces one checkbox per row, do you want more? In what way?
>>Before the user could proceed to the next page it should validate thatthe user has atleast selected one record from the grid beforeproceeding.
In your command event handler call a method to read the user's selections. If they haven't selected anything throw an error. Otherwise you can add the selected SKUs to a session variable which you can retrieve from the next page.
ArrayList SelectedSKUs = GetSelectedSKUs();
if (SelectedSKUs.Count > 0)
{
Session.Add("UserSelectedSKUs", SelectedSKUs);
}
else
{
//display an error
}
private ArrayList GetSelectedSKUs()
{
CheckBox RowCheckBox = null;
ArrayList SelectedSKUs = new ArrayList();
foreach (GridViewRow Row in GridView1.Rows)
{
RowCheckBox = (CheckBox)Row.FindControl("RowCheckBox");
if (RowCheckBox.Checked)
{
SelectedSKUs.Add(GridView1.DataKeys[Row.RowIndex]);
}
}
return SelectedSKUs;
}
Dean Fiala
Very Practical Software, Inc.