//Binding sub category on main category public void BindSubCategory() { try { ClsMaster ClsMas = new ClsMaster(); DropDownList DdlCatagory = (DropDownList)GvStockTransfer.FooterRow.FindControl("DdlCatagory"); DataTable DT = ClsMas.GetSubCategory(Convert.ToInt32(ddlMainCategory.SelectedValue)); if (DT.Rows.Count > 0) { DdlCatagory.Items.Clear(); DdlCatagory.DataSource = DT; DdlCatagory.DataValueField = "ID"; DdlCatagory.DataTextField = "NAME"; DdlCatagory.DataBind(); DdlCatagory.Items.Insert(0, new ListItem("--Select Category--", "0")); } else { DdlCatagory.Items.Clear(); } } catch (Exception) { throw; } }
public void BindSubCategory() { try { ClsMaster ClsMas = new ClsMaster(); DataTable DT = ClsMas.GetSubCategory(Convert.ToInt32(ddlType.SelectedValue)); if (DT.Rows.Count > 0) { ddlCatagory.Items.Clear(); ddlCatagory.DataSource = DT; ddlCatagory.DataValueField = "ID"; ddlCatagory.DataTextField = "NAME"; ddlCatagory.DataBind(); ddlCatagory.Items.Insert(0, new ListItem("Select Catagory", "0")); } else { ddlCatagory.Items.Clear(); } } catch (Exception) { throw; } }
//Bidning Sub Categories to Category dropdown public void bindSubCategory() { try { DataTable DT = ClsMas.GetSubCategory(Convert.ToInt32(ddlType.SelectedValue)); ddl_Category.DataSource = DT; ddl_Category.DataTextField = "NAME"; ddl_Category.DataValueField = "ID"; ddl_Category.DataBind(); ddl_Category.Items.Insert(0, new ListItem("------Select------", "0")); ddl_Category.SelectedIndex = 0; } catch (Exception) { throw; } }