void driveRowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName == "drive") { int index = Convert.ToInt32(e.CommandArgument); SqlConClass sq = new SqlConClass(); if (sq.checkRouteMatches(Session["E_Mail"].ToString(), GridView1.Rows[index].Cells[1].Text)) { Label1.Text = sq.driverAccepts(Session["E_Mail"].ToString(), GridView1.Rows[index].Cells[1].Text); Page_Load(sender, e); } else { Label2.Text = "Current route conflicts with the accepted route"; } } }