protected void lbtnActive_Click(object sender, EventArgs e) { LinkButton lbtn = (LinkButton)sender; GridViewRow gvr = (GridViewRow)lbtn.NamingContainer; var val = gvr.DataItemIndex; var status = gvr.Cells[3].Text; Statetbl st = new Statetbl(); st.StateID = Convert.ToInt32(gvr.Cells[0].Text); if (status == "Active") { st.IsActive = 0; } else if (status == "InActive") { st.IsActive = 1; } objStateBL.UpdateStateIsActive(st); GetState(); }