コード例 #1
0
        public override void AttachProperties(GridColumn gridColumn)
        {
            base.AttachProperties(gridColumn);

            GridTemplateColumn column = (GridTemplateColumn)gridColumn;

            column.HeaderText            = Caption;
            column.DataField             = DataFieldKey;
            column.CurrentFilterFunction = GridKnownFunction.EqualTo;

            DropDownListItemTemplate template = new DropDownListItemTemplate(DataFieldKey);

            column.ItemTemplate     = template;
            template.ListDataSource = ListDataSource;

            if (!IsReadOnly)
            {
                DropDownListEditItemTemplate editTemplate = new DropDownListEditItemTemplate(DataFieldKey, DataFieldKey);
                column.EditItemTemplate     = editTemplate;
                editTemplate.DropDownHeight = DropDownHeight;
            }

            DropDownListFilterTemplate filterTemplate = new DropDownListFilterTemplate(DataFieldKey);

            column.FilterTemplate         = filterTemplate;
            filterTemplate.ListDataSource = ListDataSource;
            filterTemplate.DropDownHeight = DropDownHeight;
        }
コード例 #2
0
        public GridTemplateColumn AddDropDownTemplateColumn(string dataField, string headerText, IEnumerable <BindingListItem> listDataSource)
        {
            GridTemplateColumn c = new GridTemplateColumn();

            _grid.MasterTableView.Columns.Add(c);
            c.UniqueName = dataField;
            c.DataField  = dataField;
            c.HeaderText = headerText;
            DropDownListItemTemplate template = new DropDownListItemTemplate(dataField);

            c.ItemTemplate          = template;
            template.ListDataSource = listDataSource;

            DropDownListEditItemTemplate editTemplate = new DropDownListEditItemTemplate(dataField, dataField);

            c.EditItemTemplate = editTemplate;
            return(c);
        }