public void GetCategory(long CustomerID) { ddlPrdCategory.Items.Clear(); iProductSubCategoryMasterClient SubCategoryClient = new iProductSubCategoryMasterClient(); CustomProfile profile = CustomProfile.GetProfile(); ddlPrdCategory.DataSource = SubCategoryClient.GetCategoryListByCustomer(CustomerID, profile.DBConnection._constr);; ddlPrdCategory.DataTextField = "Name"; ddlPrdCategory.DataValueField = "ID"; ddlPrdCategory.DataBind(); ListItem lst = new ListItem { Text = "-Select-", Value = "0" }; ddlPrdCategory.Items.Insert(0, lst); SubCategoryClient.Close(); }
public static List <contact> GetCategory(object objReq) { iProductSubCategoryMasterClient SubCategoryClient = new iProductSubCategoryMasterClient(); CustomProfile profile = CustomProfile.GetProfile(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); List <contact> LocList = new List <contact>(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objReq; long ddlcustomer = long.Parse(dictionary["ddlcustomer"].ToString()); ds = SubCategoryClient.GetCategoryListByCustomer(ddlcustomer, profile.DBConnection._constr); dt = ds.Tables[0]; contact Loc = new contact(); Loc.Name = "--Select--"; Loc.Id = "0"; LocList.Add(Loc); Loc = new contact(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Loc.Id = dt.Rows[i]["ID"].ToString(); Loc.Name = dt.Rows[i]["Name"].ToString(); LocList.Add(Loc); Loc = new contact(); } } } catch { } finally { SubCategoryClient.Close(); } return(LocList); }