protected void LBSearch_Click(object sender, EventArgs e) { try { SqlParameter[] arrParam = new SqlParameter[2]; arrParam[0] = new SqlParameter("@Action", "SEARCH"); arrParam[1] = new SqlParameter("@SearchText", TBSearch.Text); DataSet DSUser = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_RawMaterial_CRUD", arrParam); if (DSUser.Tables[0].Rows.Count > 0) { GVRawMaterial.DataSource = DSUser.Tables[0]; GVRawMaterial.DataBind(); } else { GVRawMaterial.EmptyDataText = "No Record Found !"; GVRawMaterial.DataBind(); } foreach (GridViewRow Row in GVRawMaterial.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; } } } catch (Exception ex) { ShowMessage(ex.Message, MessageType.Error); } }
protected void GVRawMaterial_PageIndexChanging(object sender, GridViewPageEventArgs e) { GVRawMaterial.PageIndex = e.NewPageIndex; BindGVRawMaterial(); GVRawMaterial.DataBind(); }