protected void BindDropSubCategory() { int categoryid = Convert.ToInt16(drpCategory.SelectedValue); drpSubcategory.Items.Clear(); // drpSubcategory = null; colSubCategory = objSubCategory.Get_All_By_Categoryid(categoryid); drpSubcategory.DataSource = colSubCategory; drpSubcategory.DataTextField = "Subcategoryname"; drpSubcategory.DataValueField = "Subcategoryid"; // drpSubcategory.SelectedValue = -1; drpSubcategory.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; //for (int i = 0; i < colSubCategory.Count; i++) //{ // drpSubcategory.Items[i].Text =colSubCategory[i].Subcategoryname; // drpSubcategory.Items[i].Value = colSubCategory[i].Subcategoryid.ToString(); //} //drpSubcategory.Items.Add(item); //drpSubcategory.SelectedValue = "0"; }
public void BinddrpSubcategory() { int categoryid = Convert.ToInt32(drpCategory.SelectedValue); colsubcategory = ObjSubcategory.Get_All_By_Categoryid(categoryid); drpsubcategory.DataTextField = "subcategoryname"; drpsubcategory.DataValueField = "subcategoryid"; drpsubcategory.DataSource = colsubcategory; drpsubcategory.DataBind(); }
public void BindGrid() { BLLCollection <Subcategory_mst> col = new BLLCollection <Subcategory_mst>(); int varsubcatid; varsubcatid = Convert.ToInt32(drpCategory.SelectedValue); col = ObjSubcategory.Get_All_By_Categoryid(varsubcatid); //string s = ObjSubcategory.Subcategoryname; subcategorygrdvw.DataSource = col; subcategorygrdvw.DataBind(); ClearControl(); }
protected void BindDropSubCategory() { int categoryid = Convert.ToInt32(drpCategory.SelectedValue); colSubCategory = ObjSubcategory.Get_All_By_Categoryid(categoryid); drpSubcategory.DataTextField = "subcategoryname"; drpSubcategory.DataValueField = "subcategoryid"; drpSubcategory.DataSource = colSubCategory; drpSubcategory.DataBind(); ListItem item = new ListItem(); item.Text = "-------Select Sub Category------"; item.Value = "0"; drpSubcategory.Items.Add(item); drpSubcategory.SelectedValue = "0"; }
protected void BindDropSubCategory() { try { int categoryid = Convert.ToInt16(drpCategory.SelectedValue); colSubCategory = ObjSubcategory.Get_All_By_Categoryid(categoryid); drpSubCategory.DataTextField = "subcategoryname"; drpSubCategory.DataValueField = "subcategoryid"; drpSubCategory.DataSource = colSubCategory; drpSubCategory.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; item.Value = "0"; drpSubCategory.Items.Add(item); drpSubCategory.SelectedValue = "0"; } catch (Exception ex) { ex.ToString(); } }