Exemplo n.º 1
0
 private void PopulateFieldsListBox(int categoryId)
 {
     lstFields.ValueMember   = "Id";
     lstFields.DisplayMember = "Label";
     lstFields.DataSource    = FieldService.GetFieldsByCategoryId(categoryId)
                               .OrderBy(f => f.DisplayIndex).ToList();
 }
Exemplo n.º 2
0
        private void PopulateFieldsColumns(int categoryId)
        {
            dgvShed.Columns.Clear();

            foreach (var field in FieldService.GetFieldsByCategoryId(categoryId))
            {
                var fieldColumn = new DataGridViewTextBoxColumn {
                    Name = field.Label, Tag = field.Id
                };

                if (field.DisplayIndex != null)
                {
                    fieldColumn.DisplayIndex = (int)field.DisplayIndex;
                }

                dgvShed.Columns.Add(fieldColumn);
            }
        }