/// <summary> /// Bind data to the drop down list /// </summary> public void BindDropDownData() { //Add the manufacturers to the drop-down list ManufacturerAdmin manuadmin = new ManufacturerAdmin(); dmanufacturer.DataSource = manuadmin.GetAllByPortalID(ZNodeConfigManager.SiteConfig.PortalID); dmanufacturer.DataTextField = "Name"; dmanufacturer.DataValueField = "ManufacturerID"; dmanufacturer.DataBind(); ListItem item = new ListItem("ALL", "0"); dmanufacturer.Items.Insert(0, item); //making ALL as the default value of the drop-down list box dmanufacturer.SelectedIndex = 0; //Add Producttypes to the drop-down list ProductTypeAdmin producttypeadmin = new ProductTypeAdmin(); dproducttype.DataSource = producttypeadmin.GetAllProductType(ZNodeConfigManager.SiteConfig.PortalID); dproducttype.DataTextField = "Name"; dproducttype.DataValueField = "Producttypeid"; dproducttype.DataBind(); ListItem item1 = new ListItem("ALL", "0"); dproducttype.Items.Insert(0, item1); dproducttype.SelectedIndex = 0; //Add Product categories to the drop-down list CategoryAdmin categoryadmin = new CategoryAdmin(); dproductcategory.DataSource = categoryadmin.GetAllCategories(ZNodeConfigManager.SiteConfig.PortalID); dproductcategory.DataTextField = "Name"; dproductcategory.DataValueField = "Categoryid"; dproductcategory.DataBind(); ListItem item2 = new ListItem("ALL", "0"); dproductcategory.Items.Insert(0, item2); dproductcategory.SelectedIndex = 0; }
/// <summary> /// Bind data to grid /// </summary> private void BindGridData() { CategoryAdmin categoryAdmin = new CategoryAdmin(); DataSet ds = categoryAdmin.GetAllCategories(ZNodeConfigManager.SiteConfig.PortalID).ToDataSet(true); DataView dv = new DataView(ds.Tables[0]); dv.Sort = "Name"; uxGrid.DataSource = dv; uxGrid.DataBind(); }
protected void uxGrid_Sorting(object sender, GridViewSortEventArgs e) { if (IsSearchEnabled) { CategoryAdmin categoryAdmin = new CategoryAdmin(); DataSet ds = categoryAdmin.GetCategoriesBySerachData(txtCategoryName.Text.Trim()); uxGrid.DataSource = SortDataTable(ds, e.SortExpression, true); uxGrid.DataBind(); } else { CategoryAdmin categoryAdmin = new CategoryAdmin(); DataSet categoryList = categoryAdmin.GetAllCategories(ZNodeConfigManager.SiteConfig.PortalID).ToDataSet(true); uxGrid.DataSource = SortDataTable(categoryList, e.SortExpression, true); uxGrid.DataBind(); } if (GetSortDirection() == "DESC") { e.SortDirection = SortDirection.Descending; } else { e.SortDirection = SortDirection.Ascending; } }