private void BindGVDocumentType() { SqlParameter[] arrparm = new SqlParameter[1]; arrparm[0] = new SqlParameter("@Action", "SELECT"); DataSet DSRecord = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_DocumentType_CRUD", arrparm); if (DSRecord.Tables[0].Rows.Count > 0) { GVDocumentType.DataSource = DSRecord.Tables[0]; GVDocumentType.DataBind(); } else { GVDocumentType.EmptyDataText = "No Record Found !"; GVDocumentType.DataBind(); } foreach (GridViewRow Row in GVDocumentType.Rows) { Label lblStatus = (Label)Row.FindControl("lblStatus"); LinkButton LBEdit = (LinkButton)Row.FindControl("LBEdit"); LinkButton LBDelete = (LinkButton)Row.FindControl("LBDelete"); if (lblStatus.Text == "Active") { lblStatus.CssClass = "label label-success"; LBEdit.Enabled = true; LBDelete.Enabled = true; } else { lblStatus.CssClass = "label label-danger"; LBEdit.Enabled = false; LBDelete.Enabled = false; } } }
protected void GVDocumentType_PageIndexChanging(object sender, GridViewPageEventArgs e) { GVDocumentType.PageIndex = e.NewPageIndex; BindGVDocumentType(); GVDocumentType.DataBind(); }