public void FillGrid() { DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL()); gvResultCategories.DataSource = dt; VisualAspectGrid(); }
private void FillComboBoxes() { //DataTable dtCategory = ConvertListToDataTable.ConvertTo<Category>(_cService.GetALL()); //cbCategory.DataSource = dtCategory; //foreach (Category name in _cService.GetALL()) //{ // cbCategory.Items.Add(name); //} List <Category> categories = _cService.GetALL(); var categoriesArr = categories.ToArray(); cbCategory.Items.AddRange(categoriesArr); cbCategory.DisplayMember = "Name"; //cbCategory.ValueMember = "ID"; DataTable dtIngredients = ConvertListToDataTable.ConvertTo <Ingredient>(_iService.GetALL()); cbIngredients.DataSource = dtIngredients; //foreach (Ingredient ingredient in _iService.GetALL()) //{ // cbIngredients.Items.Add(ingredient); //} cbIngredients.DisplayMember = "Name"; cbIngredients.ValueMember = "ID"; foreach (var item in Enum.GetValues(typeof(Difficulty))) { cbDifficulty.Items.Add(item); } }
public void FillGrid() { if (_title == "Categorias - Alterar") { lblTitle.Text = "―――――― ALTERAR ――――――"; DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL()); gvResultCategories.DataSource = dt; VisualAspectGrid(); } else { lblTitle.Text = "―――――― ELIMINAR ――――――"; btUpdate.Text = "Eliminar"; btUpdate.Image = Properties.Resources.delete; DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL()); gvResultCategories.DataSource = dt; VisualAspectGrid(); } }
private void FillComboBoxes() { if (!Page.IsPostBack) { List <Ingredient> ingredients = _iService.GetALL(); cbIngredients.DataSource = ingredients; cbIngredients.DataTextField = "Name"; cbIngredients.DataValueField = "ID"; cbIngredients.DataBind(); List <Category> categories = _cService.GetALL(); cbCategory.DataSource = categories; cbCategory.DataTextField = "Name"; cbCategory.DataValueField = "ID"; cbCategory.DataBind(); foreach (var item in Enum.GetValues(typeof(Difficulty))) { cbDifficulty.Items.Add(item.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { _service = new Categories_Services(); this.rptCategory.DataSource = _service.GetALL(); this.rptCategory.DataBind(); }