private void BindGVArea() { SqlParameter[] arrParam = new SqlParameter[1]; arrParam[0] = new SqlParameter("@Action", "AREA_SELECT_BY_VIEW"); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Bin_AreaMaster_CRUD", arrParam); GVArea.DataSource = ds.Tables[0]; GVArea.DataBind(); foreach (GridViewRow Row in GVArea.Rows) { Label lblStatus = (Label)Row.FindControl("lblStatus"); LinkButton LBView = (LinkButton)Row.FindControl("LBView"); LinkButton LBEdit = (LinkButton)Row.FindControl("LBEdit"); LinkButton LBDelete = (LinkButton)Row.FindControl("LBDelete"); if (lblStatus.Text == "Active") { lblStatus.CssClass = "label label-success"; LBView.Enabled = true; LBEdit.Enabled = true; LBDelete.Enabled = true; } else { lblStatus.CssClass = "label label-danger"; LBView.Enabled = false; LBEdit.Enabled = false; LBDelete.Enabled = false; } } }
public void FillGrid() { try { DataTable dt_ = new DataTable(); dt_ = DBConnection.GetQueryData("select CashBnk_id, CashBnk_nam from tbl_CashBnk where CashBnk_nam <> '1'"); GVArea.DataSource = dt_; GVArea.DataBind(); ViewState["Bank"] = dt_; } catch (Exception ex) { // throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
public void FillGrid() { try { DataTable dt_ = new DataTable(); dt_ = DBConnection.GetQueryData("select areaid, area_ from tbl_area where CompanyId='" + Session["CompanyID"] + "' and BranchId = '" + Session["BranchID"] + "'"); GVArea.DataSource = dt_; GVArea.DataBind(); ViewState["Area"] = dt_; } catch (Exception ex) { // throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
private void SearchRecord() { try { FillGrid(); DataTable _dt = (DataTable)ViewState["Bank"]; DataView dv = new DataView(_dt, "CashBnk_nam LIKE '%" + TBSearchArea.Text.Trim().ToUpper() + "%'", "[CashBnk_nam] ASC", DataViewRowState.CurrentRows); DataTable dt_ = new DataTable(); dt_ = dv.ToTable(); GVArea.DataSource = dt_; GVArea.DataBind(); ViewState["Bank"] = dt_; } catch (Exception ex) { // throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
// Method for Paging in GridView Warehouse protected void GVArea_PageIndexChanging(object sender, GridViewPageEventArgs e) { GVArea.PageIndex = e.NewPageIndex; BindGVArea(); GVArea.DataBind(); }