Monday, November 23, 2009

gridview codings

protected void btnRemove_Click(object sender, EventArgs e)
{
Requisition myReq3 = (Requisition)Session["MyRequisition"];
for (int i = 0; i < gridDetails.Rows.Count; i++)
{
CheckBox chk2 = (CheckBox)gridDetails.Rows[i].FindControl("CheckBox1");
if (chk2 != null && chk2.Checked == true)
{
string reqItem = gridDetails.Rows[i].Cells[0].Text;
if (myReq3 != null)
{
try
{
myReq3.DeleteItem(reqItem);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}

No comments: