private void BindCategoryChild() { IEnumerable <WXStoreHelper.WXCategory> category = WXStoreHelper.GetCategory(); this.ddlCategoryChild.DataTextField = "SecondCategoryName"; this.ddlCategoryChild.DataValueField = "SecondCategoryName"; this.ddlCategoryChild.DataSource = (from c in category where c.FirstCategoryName == this.ddlCategoryParent.SelectedValue select new { c.SecondCategoryName }).Distinct().ToList(); this.ddlCategoryChild.DataBind(); }
private void BindCategoryParent() { IEnumerable <WXStoreHelper.WXCategory> category = WXStoreHelper.GetCategory(); this.ddlCategoryParent.AutoPostBack = true; this.ddlCategoryParent.DataTextField = "FirstCategoryName"; this.ddlCategoryParent.DataValueField = "FirstCategoryName"; this.ddlCategoryParent.DataSource = (from c in category select new { c.FirstCategoryName }).Distinct().ToList(); this.ddlCategoryParent.DataBind(); }