protected void BtnCategoryAdd_Click(object sender, EventArgs e) { string addMe = DDLCategory.SelectedItem.Text; if (((List <string>)ViewState["catAdded"]).Count == 0) { ((List <string>)ViewState["catAdded"]).Add(addMe); GVCategory.DataSource = ((List <string>)ViewState["catAdded"]); GVCategory.DataBind(); LblCatAlert.Visible = false; } else { for (int i = 0; i < ((List <string>)ViewState["catAdded"]).Count; i++) { if (((List <string>)ViewState["catAdded"])[i].ToString() == addMe) { Utility.DisplayAlertMessage(Message.CategoryAlreadyInList); break; } if (i == ((List <string>)ViewState["catAdded"]).Count - 1) { ((List <string>)ViewState["catAdded"]).Add(addMe); GVCategory.DataSource = ((List <string>)ViewState["catAdded"]); GVCategory.DataBind(); LblCatAlert.Visible = false; break; } } } }
protected void BtnRemoveCategory_Click(object sender, EventArgs e) { //get row position of item GridViewRow row = ((System.Web.UI.WebControls.Button)sender).Parent.Parent as GridViewRow; ((List <string>)ViewState["catAdded"]).RemoveAt(row.RowIndex); GVCategory.DataSource = ((List <string>)ViewState["catAdded"]); GVCategory.DataBind(); }
public void FillGrid() { try { DataTable dt_ = new DataTable(); dt_ = DBConnection.GetQueryData("select ProductTypeID, ProductTypeName from tbl_producttype where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "'"); GVCategory.DataSource = dt_; GVCategory.DataBind(); ViewState["ItemTyp"] = dt_; } catch (Exception ex) { lbl_mssg.Text = ex.Message; } }
private void SearchRecord() { try { FillGrid(); DataTable _dt = (DataTable)ViewState["ItemTyp"]; DataView dv = new DataView(_dt, "ProductTypeName LIKE '%" + TBSearchCAtegory.Text.Trim().ToUpper() + "%'", "[ProductTypeName] ASC", DataViewRowState.CurrentRows); DataTable dt_ = new DataTable(); dt_ = dv.ToTable(); GVCategory.DataSource = dt_; GVCategory.DataBind(); ViewState["ItemTyp"] = dt_; } catch (Exception ex) { lblerr.Text = ex.Message; } }
public void FillGrid() { try { DataTable dt_ = new DataTable(); //dt_ = DBConnection.GetQueryData("select rtrim('[' + CAST(ProductTypeID AS VARCHAR(200)) + ']-' + empCat_nam ) as [empCat_nam], ProductTypeID from tbl_producttype"); dt_ = DBConnection.GetQueryData("select empCat_id, empCat_nam from tbl_empCat"); GVCategory.DataSource = dt_; GVCategory.DataBind(); ViewState["Category"] = 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 rtrim('[' + CAST(ProductTypeID AS VARCHAR(200)) + ']-' + ProductTypeName ) as [ProductTypeName], ProductTypeID from tbl_producttype"); dt_ = DBConnection.GetQueryData("select ProductTypeID, ProductTypeName from tbl_producttype where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "'"); GVCategory.DataSource = dt_; GVCategory.DataBind(); ViewState["Category"] = 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["Category"]; DataView dv = new DataView(_dt, "empCat_nam LIKE '%" + TBSearchCAtegory.Text.Trim().ToUpper() + "%'", "[empCat_nam] ASC", DataViewRowState.CurrentRows); DataTable dt_ = new DataTable(); dt_ = dv.ToTable(); GVCategory.DataSource = dt_; GVCategory.DataBind(); ViewState["Entity"] = dt_; } catch (Exception ex) { // throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
private void showCategory() { LearnSite.BLL.SoftCategory ybll = new LearnSite.BLL.SoftCategory(); GVCategory.DataSource = ybll.GetListOrder(); GVCategory.DataBind(); }