protected void lbtnCMarkAsActive_Click(object sender, EventArgs e) { LinkButton lbtn = (LinkButton)sender; GridViewRow gvr = (GridViewRow)lbtn.NamingContainer; var val = gvr.DataItemIndex; var id = gvr.Cells[2].Text; Countrytbl cnt = new Countrytbl(); cnt.CountryID = Convert.ToInt32(gvr.Cells[0].Text); if (id == "Active") { cnt.IsActive = 0; } else if (id == "InActive") { cnt.IsActive = 1; } objCountryBL.UpdateCountryIsActive(cnt); GetCountry(); }