private void BindDropSearch() { ddlSubCatName.DataSource = SubCategoryBLL.GetAllSubCategories(); ddlSubCatName.Items.Insert(0, new ListItem("Select SubCategory", "")); ddlSubCatName.DataTextField = "subCatName"; ddlSubCatName.DataValueField = "subCatID"; ddlSubCatName.DataBind(); }
public void BinddrpCatogory() { DataSet ds2 = new DataSet(); ds2 = SubCategoryBLL.GetAllSubCategories(); drpcategory.Items.Insert(0, new ListItem("Select Category", "")); drpcategory.DataSource = ds2; drpcategory.DataValueField = "subCatID"; drpcategory.DataTextField = "subCatName"; drpcategory.DataBind(); }
private void BindGrid(bool isSearch) { //if (ddlSubCatName.SelectedIndex != -1 && isSearch) //{ // SubCategoryBLL sub = new SubCategoryBLL(); // SubCategory obj = new SubCategory(); // obj.SubCategoryID = int.Parse(ddlSubCatName.SelectedValue); // ds = sub.GetById(obj); //} //else { ds = SubCategoryBLL.GetAllSubCategories(connection); } SubCategoryDisplayGrid.DataSource = ds; SubCategoryDisplayGrid.DataBind(); DropDownList catList = (DropDownList)SubCategoryDisplayGrid.FooterRow.FindControl("ddlAddCategoryName"); catList.DataSource = CategoryBLL.GetDistinct(connection); catList.DataBind(); catList.DataTextField = "categoryName"; //catList.DataValueField = "categoryID"; catList.DataBind(); DropDownList depList = (DropDownList)SubCategoryDisplayGrid.FooterRow.FindControl("ddlAddDepName"); string catId = ((DropDownList)(SubCategoryDisplayGrid.FooterRow.FindControl("ddlAddCategoryName"))).SelectedItem.Text; Category obj2 = new Category(); obj2.Name = catId; CategoryBLL ins = new CategoryBLL(); depList.DataSource = ins.GetDepListByCategoryName(obj2, connection); depList.DataBind(); depList.DataTextField = "Name"; depList.DataValueField = "DepId"; depList.DataBind(); }