private void BindGVGodown() { string SelectGodown = "SELECT * FROM View_GodownDetails"; DataSet DSRecord = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, SelectGodown); if (DSRecord.Tables[0].Rows.Count > 0) { GVGodown.DataSource = DSRecord.Tables[0]; GVGodown.DataBind(); } else { GVGodown.EmptyDataText = "No Record Found !"; GVGodown.DataBind(); } GVStatus(); }
protected void SearchEvent(object sender, EventArgs e) { string SearchText = "SELECT * FROM View_GodownDetails "; SearchText += " WHERE View_GodownDetails.BusinessLocationName LIKE '" + TBSearch.Text + "%'"; SearchText += " OR View_GodownDetails.Name LIKE '" + TBSearch.Text + "%'"; DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.Text, SearchText); if (ds.Tables[0].Rows.Count > 0) { GVGodown.DataSource = ds.Tables[0]; GVGodown.DataBind(); } else { GVGodown.EmptyDataText = "No Record Found !!"; GVGodown.DataBind(); } GVStatus(); }
// Method for Bind GridView Warehouse private void BindGVGodown() { SqlParameter[] arrParam = new SqlParameter[1]; arrParam[0] = new SqlParameter("@Action", "SELECT_ByDefault"); DataSet ds = SqlHelper.ExecuteDataset(Connection.connect(), CommandType.StoredProcedure, "SP_Godown_CRUD", arrParam); GVGodown.DataSource = ds.Tables[0]; GVGodown.DataBind(); foreach (GridViewRow Row in GVGodown.Rows) { Label lblStatus = (Label)Row.FindControl("lblStatus"); if (lblStatus.Text == "Active") { lblStatus.CssClass = "label label-success"; } else { lblStatus.CssClass = "label label-danger"; } } }
protected void GVGodown_PageIndexChanging(object sender, GridViewPageEventArgs e) { GVGodown.PageIndex = e.NewPageIndex; BindGVGodown(); GVGodown.DataBind(); }