protected void Mark_Present(object sender, CommandEventArgs e) { string course_id = Request.QueryString["val1"]; string sectionid = Request.QueryString["val2"]; int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button // from the Rows collection. GridViewRow row = Students.Rows[index]; string roll_no = row.Cells[0].Text; objBL.Mark_Present(roll_no, course_id, sectionid); }