Telerik Forums
UI for WinForms Forum
2 answers
99 views
Please tell me what is wrong with my code?
Every time i set the .Text to null it gives error "Object reference not set to an instance of an object."

public Form1()
    {
      InitializeComponent();

      DataTable dt = new DataTable();
      dt.Columns.Add("TEST");
      for (int i = 0; i < 5; i++)
      {
        dt.Rows.Add(Guid.NewGuid());
      }
      this.radMultiColumnComboBox1.DataSource = dt;

      this.radMultiColumnComboBox1.Text = null;
    }

    private void radButton1_Click(object sender, EventArgs e)
    {
      this.radMultiColumnComboBox1.Text = null;
    }
Stefan
Telerik team
 answered on 26 May 2014
2 answers
127 views
Hello,


I am looking for a way to control when a cell is edited in a GanttViewTextViewCellElement. If certain conditions are met, the old value should be reset. How and when should I add handlers?

I am thinking on the editors of each cellElement but I dont know how to reach them in a way like in Gridview where the CellBeginEdit event is handy for it.

Thanks,
Lorenzo.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 26 May 2014
4 answers
112 views
Hi everyone!
We are doing project with grid hierarchy and tabbed views.
But there are 2 problems:
1. If there is no records in both fields of DataSource, both tabs are not displayed. If only first field has no records, second tab also is not displayed.
2. PageViewMode change does not affect the type of grouping tabs. 

I made little project to repeat second problem and partly first.
001.public partial class Form1 : Form
002.{
003.    public Form1()
004.    {
005.        InitializeComponent();
006. 
007.        var myPrograms = new List<MyProgram>();
008. 
009.        for (int i = 0; i < 5; i++)
010.        {
011.            var actions = new List<Action>();
012.            for (int j = 0; j < 3; j++)
013.            {
014.                var newServices1 = new List<Service1>();
015.                for (int k = 0; k < 3; k++)
016.                {
017.                    newServices1.Add(new Service1 { Code1 = "code1" + k });
018.                }
019. 
020.                var newServices2 = new List<Service2>();
021.                for (int k = 0; k < 3; k++)
022.                {
023.                    var newService2 = new Service2 { Code2 = "code2" + k };
024.                    newService2.Internals = new List<InternalService>();
025.                    for (int l = 0; l < 3; l++)
026.                    {
027.                        newService2.Internals.Add(new InternalService {Internal = "Internal" + l});
028.                    }
029.                    newServices2.Add(newService2);
030.                }
031. 
032.                actions.Add(new Action
033.                {
034.                    Type = "Type" + j,
035.                 //   Services1 = newServices1,
036.                    Services2 = newServices2
037.                });
038.            }
039. 
040.            var newOne = new MyProgram
041.            {
042.                Name = "Name " + i,
043.                Actions = actions
044.            };
045. 
046.            myPrograms.Add(newOne);
047.        }
048. 
049. 
050. 
051. 
052.        var first = new RadGridViewTemplate
053.        {
054.            Columns = new BindingColumn[] { new BindingColumn { FieldName = "Name" } },
055.            Relation = null,
056.        };
057. 
058.        var second = new RadGridViewTemplate
059.        {
060.            ParentTemplate = first,
061.            Columns = new BindingColumn[] { new BindingColumn { FieldName = "Type" } },
062.            Relation = new RadRelation("ProgramToAction",
063.                null, new[]
064.                {
065.                    "Actions"
066.                })
067.        };
068. 
069.        first.ChildTemplates.Add(second);
070. 
071.        var third1 = new RadGridViewTemplate
072.        {
073.            ParentTemplate = second,
074.            Columns = new BindingColumn[] { new BindingColumn { FieldName = "Code1" } },
075.            Relation = new RadRelation("ActionToOneTimeService", null,
076.                new[]
077.                {
078.                    "Services1"
079.                }),
080.            CaptionText = "Разовые"
081.        };
082.        var third2 = new RadGridViewTemplate
083.        {
084.            ParentTemplate = second,
085.            Columns = new BindingColumn[] { new BindingColumn { FieldName = "Code2" } },
086.            Relation = new RadRelation("ActionToRegularService", null,
087.                new[]
088.                {
089.                    "Services2"
090.                }),
091.            CaptionText = "Регулярные"
092.        };
093. 
094.        second.ChildTemplates.Add(third1);
095.        second.ChildTemplates.Add(third2);
096. 
097.        var fourth = new RadGridViewTemplate
098.        {
099.            ParentTemplate = third2,
100.            Columns = new BindingColumn[] { new BindingColumn { FieldName = "Internal" } },
101.            Relation = new RadRelation("ToRegularSeviceInfo", null,
102.                new[]
103.                {
104.                    "Internals"
105.                })
106.        };
107. 
108.        third2.ChildTemplates.Add(fourth);
109. 
110.        AddBindingColumnRange(rgvMain.MasterTemplate, first.Columns);
111.        AddGridTemplateRecursivly(rgvMain, rgvMain.MasterTemplate, first.ChildTemplates);
112. 
113.        rgvMain.DataSource = myPrograms;
114.        rgvMain.TableElement.PageViewMode = PageViewMode.Stack;
115.    }
116. 
117.    private void AddBindingColumnRange(GridViewTemplate gridViewTemplate, IEnumerable<BindingColumn> list)
118.    {
119.        foreach (BindingColumn column in list)
120.        {
121.            gridViewTemplate.Columns.Add(column.ToGridViewDataColumn());
122.        }
123.    }
124. 
125.    private void AddGridTemplateRecursivly(RadGridView forRelations, GridViewTemplate parentTemplate,
126.        List<RadGridViewTemplate> radGridViewTemplates)
127.    {
128.        if (parentTemplate == null || radGridViewTemplates.Count == 0)
129.        {
130.            return;
131.        }
132. 
133.        foreach (var template in radGridViewTemplates)
134.        {
135.            // add child template
136.            GridViewTemplate childTemplate = template.ToGridViewTemplate();
137.            AddBindingColumnRange(childTemplate, template.Columns);
138. 
139.            parentTemplate.Templates.Add(childTemplate);
140.            //parentTemplate.AllowCellContextMenu = false;
141.            //childTemplate.AllowCellContextMenu = false;
142. 
143.            //add relation
144.            GridViewRelation firstRelation = template.Relation.ToGridViewRelation();
145.            firstRelation.ChildTemplate = childTemplate;
146.            firstRelation.ParentTemplate = parentTemplate;
147.            forRelations.Relations.Add(firstRelation);
148. 
149.            AddGridTemplateRecursivly(forRelations, childTemplate, template.ChildTemplates);
150.        }
151.    }
152.}
153. 
154. 
155.class MyProgram
156.{
157.    public string Name { get; set; }
158. 
159.    public List<Action> Actions { get; set; }
160.}
161. 
162.class Action
163.{
164.    public string Type { get; set; }
165. 
166.    public List<Service1> Services1 { get; set; }
167.    public List<Service2> Services2 { get; set; }
168.}
169. 
170.class Service1
171.{
172.    public string Code1 { get; set; }
173.}
174. 
175.class Service2
176.{
177.    public string Code2 { get; set; }
178. 
179.    public List<InternalService> Internals { get; set; }
180.}
181. 
182.class InternalService
183.{
184.    public string Internal { get; set; }
185.}
186. 
187.public class BindingColumn
188.{
189.    public BindingColumn()
190.    {
191.        IsVisible = true;
192.        IsReadOnly = true;
193.    }
194. 
195.    public string FieldName { get; set; }
196.    public string UniqueName { get; set; }
197.    public string HeaderText { get; set; }
198.    public bool IsVisible { get; set; }
199.    public bool IsReadOnly { get; set; }
200. 
201.    public GridViewDataColumn ToGridViewDataColumn()
202.    {
203.        string uniqueName = string.IsNullOrEmpty(UniqueName) ? FieldName + Guid.NewGuid() : UniqueName;
204. 
205.        GridViewDataColumn column = new GridViewTextBoxColumn(uniqueName, FieldName)
206.        {
207.            IsVisible = IsVisible,
208.            ReadOnly = IsReadOnly
209.        };
210. 
211.        if (!string.IsNullOrEmpty(HeaderText))
212.        {
213.            column.HeaderText = HeaderText;
214.        }
215. 
216.        return column;
217.    }
218.}
219. 
220.public class RadGridViewTemplate
221.{
222.    public IList<BindingColumn> Columns { get; set; }
223.    public RadGridViewTemplate ParentTemplate { get; set; }
224.    public List<RadGridViewTemplate> ChildTemplates { get; private set; }
225.    public RadRelation Relation { get; set; }
226.    public string CaptionText { get; set; }
227. 
228.    public RadGridViewTemplate()
229.    {
230.        ChildTemplates = new List<RadGridViewTemplate>();
231.    }
232. 
233.    public GridViewTemplate ToGridViewTemplate()
234.    {
235.        var result = new GridViewTemplate
236.        {
237.            AllowAddNewRow = false,
238.            AllowColumnChooser = false,
239.            AllowDeleteRow = false,
240.            AutoGenerateColumns = false,
241.            AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill,
242.            Caption = CaptionText
243.        };
244. 
245.        return result;
246.    }
247.}
248. 
249.public class RadRelation
250.{
251.    public RadRelation(string relationName, IList<string> parentColumnNames, IList<string> childColumnNames)
252.    {
253.        RelationName = relationName;
254.        ParentColumnNames = parentColumnNames;
255.        ChildColumnNames = childColumnNames;
256.    }
257. 
258.    public string RelationName { get; set; }
259.    public IList<string> ParentColumnNames { get; set; }
260.    public IList<string> ChildColumnNames { get; set; }
261. 
262.    public GridViewRelation ToGridViewRelation()
263.    {
264.        var r = new GridViewRelation {RelationName = RelationName};
265. 
266.        if (ChildColumnNames != null)
267.        {
268.            foreach (string columnName in ChildColumnNames)
269.            {
270.                r.ChildColumnNames.Add(columnName);
271.            }
272.        }
273. 
274.        if (ParentColumnNames != null)
275.        {
276.            foreach (string columnName in ParentColumnNames)
277.            {
278.                r.ParentColumnNames.Add(columnName);
279.            }
280.        }
281.        return r;
282.    }
283.}



Also the source code of our class, which we use to abstraction GridView.
namespace ProjectControls
{
    public sealed partial class RadCommonDataListControl : UserControl, IGridViewExtended
    {
        private readonly Dictionary<GridViewCommandColumn, Func<object, bool>> _commandColumnDictionary =
            new Dictionary<GridViewCommandColumn, Func<object, bool>>();
 
        private readonly CommandManager _commandManager;
        private readonly RadCommonDataListControlPresenter _presenter;
        private readonly int _rcbHeight;
        private bool _commandInited;
 
        private readonly IList<string> _customSortingFieldNames = new List<string>();
 
        public RadCommonDataListControl()
        {
            InitializeComponent();
            _presenter = new RadCommonDataListControlPresenter();
            _commandManager = CommandManager.Create(components);
            _rcbHeight = rcbMain.Height;
            rgvMain.AllowCellContextMenu = false;
        }
 
        #region ShowButtons
 
        [Browsable(true)]
        public bool ShowAddButton
        {
            [UsedImplicitly] get { return cbbAdd.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbAdd.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiAdd.Visibility = cbbAdd.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowExportButton
        {
            [UsedImplicitly] get { return cbbExport.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbExport.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiExport.Visibility = cbbExport.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowImportButton
        {
            [UsedImplicitly] get { return cbbImport.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbImport.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiImport.Visibility = cbbImport.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowClientCardButton
        {
            [UsedImplicitly]
            get { return cbbShowClientCard.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbShowClientCard.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiShowClientCard.Visibility = cbbShowClientCard.Visibility;
            }
        }
 
         
        [Browsable(true)]
        public bool ShowPrintButton
        {
            [UsedImplicitly] get { return cbbPrint.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbPrint.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiPrint.Visibility = cbbPrint.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowHistoryButton
        {
            [UsedImplicitly] get { return cbbShowHistory.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbShowHistory.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiShowHistory.Visibility = cbbShowHistory.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowAddExtraButton
        {
            [UsedImplicitly] get { return cbbAddExtra.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbAddExtra.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiAddExtra.Visibility = cbbAddExtra.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowArchivedToogleButton
        {
            [UsedImplicitly]
            get { return cbbShowArchived.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbShowArchived.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiShowArchived.Visibility = cbbShowArchived.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowEditButton
        {
            [UsedImplicitly]
            get { return cbbEdit.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbEdit.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiEdit.Visibility = cbbEdit.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowDeleteButton
        {
            [UsedImplicitly]
            get { return cbbDelete.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbDelete.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiDelete.Visibility = cbbDelete.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowAddExtraButtonMulti
        {
            [UsedImplicitly]
            get { return cbbAddExtraMulti.Visibility == ElementVisibility.Visible; }
            set { cbbAddExtraMulti.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed; }
        }
 
        [Browsable(true)]
        public bool ShowRestoreButton
        {
            [UsedImplicitly]
            get { return cbbRestore.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbRestore.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiRestore.Visibility = cbbRestore.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowRefreshButton
        {
            [UsedImplicitly]
            get { return cbbRefresh.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbRefresh.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiRefresh.Visibility = cbbRefresh.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowExpandAllButton
        {
            [UsedImplicitly]
            get { return cbbExpandAll.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbExpandAll.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiExpandAll.Visibility = cbbExpandAll.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowCollapseAllButton
        {
            [UsedImplicitly]
            get { return cbbCollapseAll.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbCollapseAll.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiCollapseAll.Visibility = cbbCollapseAll.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowCheckAllButton
        {
            [UsedImplicitly]
            get { return cbbCheckAll.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbCheckAll.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiCheckAll.Visibility = cbbCheckAll.Visibility;
            }
        }
 
        [Browsable(true)]
        public bool ShowClearSelectionButton
        {
            [UsedImplicitly]
            get { return cbbClearSelection.Visibility == ElementVisibility.Visible; }
            set
            {
                cbbClearSelection.Visibility = value ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                rmiClearSelection.Visibility = cbbClearSelection.Visibility;
            }
        }
 
        #endregion
 
        [Browsable(true)]
        public string AddExtraButtonText
        {
            [UsedImplicitly] get { return cbbAddExtra.Text; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbAddExtra.Text = value;
                    rmiAddExtra.Text = value;
                }
            }
        }
 
        [Browsable(true)]
        public string AddButtonText
        {
            [UsedImplicitly] get { return cbbAdd.Text; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbAdd.Text = value;
                    rmiAdd.Text = value;
                }
            }
        }
 
        [Browsable(true)]
        public bool ShowCommandBar
        {
            [UsedImplicitly] get { return rcbMain.Visible; }
            set
            {
                rcbMain.Height = value ? _rcbHeight : 0;
                rcbMain.Visible = value;
                rcbMain.Enabled = value;
            }
        }
 
        public int RowCount
        {
            get { return rgvMain.RowCount; }
        }
 
        [Browsable(true)]
        public string ToolTipAddButton
        {
            [UsedImplicitly] get { return cbbAdd.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbAdd.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipImportButton
        {
            [UsedImplicitly]
            get { return cbbImport.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbImport.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipClientCardButton
        {
            [UsedImplicitly]
            get { return cbbShowClientCard.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbShowClientCard.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipAddExtraButton
        {
            [UsedImplicitly] get { return cbbAddExtra.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbAddExtra.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipEditButton
        {
            [UsedImplicitly] get { return cbbEdit.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbEdit.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipDeleteButton
        {
            [UsedImplicitly] get { return cbbDelete.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbDelete.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipRefreshButton
        {
            [UsedImplicitly] get { return cbbRefresh.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbRefresh.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipArchivedButton
        {
            [UsedImplicitly] get { return cbbShowArchived.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbShowArchived.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipExpandAll
        {
            [UsedImplicitly]
            get { return cbbExpandAll.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbExpandAll.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipCollapseAll
        {
            [UsedImplicitly]
            get { return cbbCollapseAll.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbCollapseAll.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipCheckAllButton
        {
            [UsedImplicitly] get { return cbbCheckAll.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbCheckAll.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipClearSelectionButton
        {
            [UsedImplicitly] get { return cbbClearSelection.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbClearSelection.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipAddExtraMulti
        {
            [UsedImplicitly] get { return cbbAddExtraMulti.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbAddExtraMulti.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipRestoreButton
        {
            [UsedImplicitly] get { return cbbRestore.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbRestore.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipHistoryButton
        {
            [UsedImplicitly] get { return cbbShowHistory.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbShowHistory.ToolTipText = value;
                }
            }
        }
 
        [Browsable(true)]
        public string ToolTipPrintButton
        {
            [UsedImplicitly] get { return cbbPrint.ToolTipText; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    cbbPrint.ToolTipText = value;
                }
            }
        }
 
        public bool IsNeedShowArchived { get; private set; }
 
        public void InitializeCommands(IEnumerable<IGridCommand> commands)
        {
            //TODO: 1. Опять не дизэйблится menuItem в контекстном меню
            //TODO: 2. Не работает редактиравние по дабл клинку.
 
 
            if (_commandInited) return;
            rcbMain.BindingContext = new BindingContext();
 
            foreach (IGridCommand command in commands)
            {
                switch (command.CommandType)
                {
                    case GridCommandType.Add:
                        _commandManager.Bind(command, cbbAdd);
                        _commandManager.Bind(command, rmiAdd);
                        break;
                    case GridCommandType.AddExtra:
                        _commandManager.Bind(command, cbbAddExtra);
                        _commandManager.Bind(command, rmiAddExtra);
                        break;
                    case GridCommandType.AddExtraMulti:
                        var radMenuItem = new RadMenuItem
                        {
                            Text = command.Text
                        };
 
                        cbbAddExtraMulti.Items.Add(radMenuItem);
 
                        _commandManager.Bind(command, radMenuItem);
                        break;
                    case GridCommandType.Edit:
                        _commandManager.Bind(command, cbbEdit);
                        _commandManager.Bind(command, rmiEdit);
                        _commandManager.Bind(command, rgvMain);
                        break;
                    case GridCommandType.Delete:
                        _commandManager.Bind(command, cbbDelete);
                        _commandManager.Bind(command, rmiDelete);
                        break;
                    case GridCommandType.Refresh:
                        _commandManager.Bind(command, cbbRefresh);
                        _commandManager.Bind(command, rmiRefresh);
                        break;
                    case GridCommandType.Restore:
                        _commandManager.Bind(command, cbbRestore);
                        _commandManager.Bind(command, rmiRestore);
                        break;
                    case GridCommandType.CheckAll:
                        _commandManager.Bind(command, cbbCheckAll);
                        _commandManager.Bind(command, rmiCheckAll);
                        break;
                    case GridCommandType.ClearSelection:
                        _commandManager.Bind(command, cbbClearSelection);
                        _commandManager.Bind(command, rmiClearSelection);
                        break;
                    case GridCommandType.ShowHistory:
                        _commandManager.Bind(command, cbbShowHistory);
                        _commandManager.Bind(command, rmiShowHistory);
                        break;
                    case GridCommandType.ShowArchived:
                        _commandManager.Bind(command, cbbShowArchived);
                        _commandManager.Bind(command, rmiShowArchived);
                        break;
                    case GridCommandType.Print:
                        _commandManager.Bind(command, cbbPrint);
                        _commandManager.Bind(command, rmiPrint);
                        break;
                    case GridCommandType.Export:
                        _commandManager.Bind(command, cbbExport);
                        _commandManager.Bind(command, rmiExport);
                        break;
                    case GridCommandType.Import:
                        _commandManager.Bind(command, cbbImport);
                        _commandManager.Bind(command, rmiImport);
                        break;
                    case GridCommandType.ShowClientCard:
                        _commandManager.Bind(command, cbbShowClientCard);
                        _commandManager.Bind(command, rmiShowClientCard);
                        break;
                    case GridCommandType.ExpandAll:
                        _commandManager.Bind(command, cbbExpandAll);
                        _commandManager.Bind(command, rmiExpandAll);
                        break;
                    case GridCommandType.CollapseAll:
                        _commandManager.Bind(command, cbbCollapseAll);
                        _commandManager.Bind(command, rmiCollapseAll);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
            _commandInited = true;
        }
 
        public GridCellElement SelectedCell
        {
            get
            {
                return rgvMain.CurrentCell;
            }
        }
 
        public void SetDatasource<T>(BindingList<T> list)
        {
            CheckColumn();
            rgvMain.SmartUpdate(list);
 
            OnSelectionChanged();
        }
 
        object IGridView.SelectedItem
        {
            get { return rgvMain.GetSelectedItem(); }
        }
 
 
 
        public MasterGridViewTemplate MasterTemplate
        {
            get
            {
                return rgvMain.MasterTemplate;
            }
        }
 
        public object DataSource
        {
            get
            {
                return rgvMain.DataSource;
            }
        }
 
 
        private void CheckColumn()
        {
            if (rgvMain.ColumnCount == 0)
            {
                throw new InvalidOperationException("No columns in gridview! Setting canceled!");
            }
        }
 
        private void grdMyGrid_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
        {
//            var element = sender as GridHeaderCellElement;
//            if (element != null)
//            {
//                e.ToolTipText = element.Text;
//            }
            GridDataCellElement cell = sender as GridDataCellElement;
 
            if (cell != null && cell.Value != null)
            {
                e.ToolTipText = cell.Value.ToString();
            }
        }
 
        public void DisableContextMemu()
        {
            rcmmMain.SetRadContextMenu(rgvMain, null);
        }
 
        public void SetColumnVisibleStatus(string columnName, bool value)
        {
            if (rgvMain.Columns[columnName] != null)
            {
                rgvMain.Columns[columnName].IsVisible = value;
            }
        }
 
        public int? GetSelectedRowIndex()
        {
            return rgvMain.GetSelectedRowIndex();
        }
 
        public T SelectedItem<T>()
        {
            return rgvMain.GetSelectedItem<T>();
        }
 
        public void AddBindingColumnRange(IEnumerable<BindingColumn> list)
        {
            foreach (BindingColumn column in list)
            {
                AddBindingColumn(column, rgvMain.Columns);
            }
        }
 
        private void RgvMainSelectionChanged(object sender, EventArgs e)
        {
            OnSelectionChanged();
        }
 
        public void SetFilteringStatus(bool status)
        {
            rgvMain.EnableFiltering = status;
            rgvMain.MasterTemplate.EnableFiltering = status;
        }
 
        public void ExecuteAddCommand()
        {
            if (_presenter == null || _presenter.AddCommand == null)
            {
                throw new NullReferenceException("AddCommand");
            }
            _presenter.AddCommand.Execute();
        }
 
        public void ExecuteEditCommand()
        {
            if (_presenter == null || _presenter.EditCommand == null)
            {
                throw new NullReferenceException("EditCommand");
            }
            _presenter.EditCommand.Execute();
        }
 
        public void ExecuteShowHistoryCommand()
        {
            if (_presenter == null || _presenter.ShowHistoryCommand == null)
            {
                throw new NullReferenceException("ShowHistoryCommand");
            }
            _presenter.ShowHistoryCommand.Execute();
        }
 
        public void ExecuteDeleteCommand()
        {
            if (_presenter == null || _presenter.DeleteCommand == null)
            {
                throw new NullReferenceException("DeleteCommand");
            }
            _presenter.DeleteCommand.Execute();
        }
 
 
        public T GetDataInRow<T>(int index)
        {
            return (T) rgvMain.Rows[index].DataBoundItem;
        }
 
        //public void CheckColumn(int rowIndex, int columnIndex)
        //{
        //    rgvMain.Rows[rowIndex].Cells[columnIndex].Value = true;
        //}
 
        public void ExecuteRefreshCommand()
        {
            cbbRefresh.CallDoClick(null);
        }
 
        private void rgvMain_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            if (e.ContextMenuProvider is GridHeaderCellElement)
            {
                e.Cancel = true;
            }
        }
 
        private void rgvMain_ValueChanged(object sender, EventArgs e)
        {
                rgvMain.EndEdit();
        }
 
        public void ExecutePrintCommand()
        {
            if (_presenter != null)
            {
                if (_presenter.PrintCommand != null && _presenter.PrintCommand.Enabled)
                {
                    _presenter.PrintCommand.Execute();
                }
            }
        }
 
 
        private void cbbShowArchived_MouseDown(object sender, MouseEventArgs e)
        {
            IsNeedShowArchived = !IsNeedShowArchived;
        }
 
        private void rmiShowArchived_MouseDown(object sender, MouseEventArgs e)
        {
            IsNeedShowArchived = !IsNeedShowArchived;
        }
 
        private void rmiShowArchived_ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            cbbShowArchived.ToggleStateChanged -= cbbShowArchived_ToggleStateChanged;
            cbbShowArchived.InvertToggleState();
            cbbShowArchived.ToggleStateChanged += cbbShowArchived_ToggleStateChanged;
        }
 
        private void cbbShowArchived_ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            rmiShowArchived.ToggleStateChanged -= rmiShowArchived_ToggleStateChanged;
            rmiShowArchived.InvertToggleState();
            rmiShowArchived.ToggleStateChanged += rmiShowArchived_ToggleStateChanged;
        }
 
 
        private void rgvGroupSummaryEvaluate(object sender, GroupSummaryEvaluationEventArgs e)
        {
            if (e.Group.Header == string.Empty)
            {
                e.FormatString = " ";
                e.Group.Expand();
            }
            else
            {
                e.FormatString = e.Group.Header;
            }
        }
 
        public void SetGroupCustomExpanding()
        {
            rgvMain.GroupSummaryEvaluate += rgvGroupSummaryEvaluate;
        }
 
        public void AddGrouping(GridGroupDescriptor groupDescriptor)
        {
            rgvMain.EnableGrouping = true;
            rgvMain.GroupDescriptors.Clear();
 
            var descriptor = new GroupDescriptor();
            GridViewDataColumn gridViewDataColumn =
                rgvMain.MasterTemplate.Columns.GetColumnByFieldName(groupDescriptor.UniqueGroupColumnName)
                    .FirstOrDefault();
            if (gridViewDataColumn != null)
            {
                ListSortDirection listSortDirection = groupDescriptor.SortDirection == GridSortDirection.Ascending
                    ? ListSortDirection.Ascending
                    : ListSortDirection.Descending;
 
                descriptor.GroupNames.Add(gridViewDataColumn.Name, listSortDirection);
                rgvMain.GroupDescriptors.Add(descriptor);
 
                if (groupDescriptor.IsNeedExpand)
                {
                    rgvMain.MasterTemplate.ExpandAllGroups();
                }
            }
        }
 
 
        public void SetHierarchy(string childColumn, string columnFieldName, string columnHeaderText,
            string visibleColumn)
        {
            rgvMain.MasterTemplate.Templates.Clear();
            rgvMain.Templates.Clear();
            rgvMain.Relations.Clear();
            rgvMain.ShowRowHeaderColumn = false;
 
            var template = new GridViewTemplate
            {
                AllowAddNewRow = false,
                ReadOnly = true,
                ShowRowHeaderColumn = false,
                AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill,
                AllowCellContextMenu = false
            };
 
            rgvMain.Templates.Add(template);
 
            template.Columns.Add(new GridViewTextBoxColumn
            {
                FieldName = columnFieldName,
                HeaderText = columnHeaderText
            });
            var relation = new GridViewRelation(rgvMain.MasterTemplate, template);
            relation.ChildColumnNames.Add(childColumn);
 
            rgvMain.Relations.Add(relation);
 
            foreach (GridViewDataColumn column in template.Columns)
            {
                column.IsVisible = column.FieldName == visibleColumn;
            }
        }
 
        private void rgvMain_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        {
             
            if (e.CellElement.RowIndex <= -1) return;
            var column = e.CellElement.ColumnInfo as GridViewCommandColumn;
            Func<object, bool> func;
            if (column == null || !_commandColumnDictionary.TryGetValue(column, out func)) return;
            var commandCell = (GridCommandCellElement)e.CellElement;
            var buttonElement = (RadButtonElement)commandCell.Children[0];
 
            if (func != null)
            {
                buttonElement.Enabled = func(e.Row.DataBoundItem);
            }
        }
 
        public bool BoldHeaderText { get; set; }
 
        [DebuggerStepThrough]
        private bool IsExpandable(GridViewRowInfo rowInfo)
        {
            return rowInfo.ChildRows != null && rowInfo.ChildRows.Count > 0;
        }
 
        private void rgvMain_ChildViewExpanding(object sender, ChildViewExpandingEventArgs e)
        {
            e.Cancel = !IsExpandable(e.ParentRow);
        }
 
        [Browsable(true)]
        public event CommandCellClickEventHandler CommandCellClick
        {
            add { rgvMain.CommandCellClick += value; }
            remove { rgvMain.CommandCellClick -= value; }
        }
 
        private void rgvMain_ViewCellFormatting_1(object sender, CellFormattingEventArgs e)
        {
            var cell = e.CellElement as GridGroupExpanderCellElement;
            if (cell != null && e.CellElement.RowElement is GridDataRowElement)
            {
                cell.Expander.Visibility = !IsExpandable(cell.RowInfo)
                    ? ElementVisibility.Hidden
                    : ElementVisibility.Visible;
            }
            e.CellElement.DrawFill = false;
            e.CellElement.BorderWidth = 0;
        }
 
        public void ShowCellSelectionBorder()
        {
            rgvMain.ViewCellFormatting += CellSelectionBorder;
        }
 
        private void NaturalSortingByField(object sender, GridViewCustomSortingEventArgs e)
        {
            e.Handled = SortTemplates(rgvMain.MasterTemplate, e);
        }
 
        private bool SortTemplate(GridViewTemplate template, GridViewCustomSortingEventArgs e)
        {
            bool handled = false;
 
            foreach (var name in _customSortingFieldNames)
            {
                int descriptorIndex = -1;
                for (int i = 0; i < template.SortDescriptors.Count; i++)
                {
                    if (template.SortDescriptors[i].PropertyName == name)
                    {
                        descriptorIndex = i;
                    }
                }
 
                if (descriptorIndex != -1)
                {
                    int columnIndex = -1;
                    for (int i = 0; i < template.ColumnCount; i++)
                    {
                        if (template.Columns[i].Name == template.SortDescriptors[descriptorIndex].PropertyName)
                        {
                            columnIndex = i;
                        }
                    }
 
                    var row1Code = (string)e.Row1.Cells[columnIndex].Value;
                    var row2Code = (string)e.Row2.Cells[columnIndex].Value;
 
                    e.SortResult = ServiceFormCodeLogicalComparer.Compare(row1Code, row2Code);
                    if (template.SortDescriptors[descriptorIndex].Direction == ListSortDirection.Descending)
                    {
                        e.SortResult *= -1;
                    }
 
                    handled = true;
                }
            }
 
            return handled;
        }
 
        private bool SortTemplates(GridViewTemplate template, GridViewCustomSortingEventArgs e)
        {
            if (template == null)
            {
                return false;
            }
 
            bool handled = SortTemplate(template, e);
 
            foreach (var child in template.Templates)
            {
                handled |= SortTemplates(child, e);
            }
 
            return handled;
        }
 
        private void CellSelectionBorder(object sender, CellFormattingEventArgs e)
        {
            //TODO: Залепуха для отображения рамки селектора в нижнем уровне журнала ИПР
                if (e.CellElement.IsCurrent && e.CellElement.ViewTemplate.Templates.Count == 0)
                {
                    e.CellElement.BorderWidth = 2;
                    return;
                }
        }
 
 
        public void ExportToExcel(string filepath)
        {
            var excelMl = new ExportToExcelML(rgvMain);
            excelMl.RunExport(filepath);
        }
 
        #region Events
 
        [Browsable(true)]
        public event EventHandler SelectionChanged;
        public event GridViewCellEventHandler CellValueChanged;
 
        private void OnSelectionChanged()
        {
            EventHandler handler = SelectionChanged;
            if (handler != null) handler(this, EventArgs.Empty);
        }
 
        private void rgvMain_CellValueChanged(object sender, GridViewCellEventArgs e)
        {
            if (CellValueChanged != null)
            {
                CellValueChanged(sender, e);
            }
        }
 
        #endregion
 
        #region Hierarchical grid
 
        private void AddBindingColumnRange(GridViewTemplate gridViewTemplate, IEnumerable<BindingColumn> list)
        {
            foreach (BindingColumn column in list)
            {
                AddBindingColumn(column, gridViewTemplate.Columns);
            }
        }
 
        private void AddBindingColumn(BindingColumn bindingColumn, GridViewColumnCollection columns) //GridViewTemplate gridViewTemplate = null)
        {
            GridViewDataColumn column = bindingColumn.ToGridViewDataColumn();
             
            //TODO: Если содержится колонка с чекбоксом в хедере, то нужно сделать хедер больше по высоте.
            if (bindingColumn.ColumnType == RadGridViewColumnType.CheckBoxColumnCheckableHeader)
            {
                rgvMain.MasterView.TableHeaderRow.MinHeight = 21;
 
            }
            var commandBindingColumn = bindingColumn as CommandBindingColumn;
            var gridViewCommandColumn = column as GridViewCommandColumn;
            if (commandBindingColumn != null && gridViewCommandColumn != null)
            {
                _commandColumnDictionary.Add(gridViewCommandColumn, commandBindingColumn.CanExecute);
            }
 
            if (bindingColumn.IsNaturalSorting)
            {
                if (!rgvMain.EnableCustomSorting)
                {
                    rgvMain.EnableCustomSorting = true;
                    rgvMain.CustomSorting += NaturalSortingByField;
                }
 
                if (!columns.Owner.EnableCustomSorting)
                {
                    columns.Owner.EnableCustomSorting = true;
                }
 
                _customSortingFieldNames.Add(column.Name);
            }
 
            if (bindingColumn is ConditionalEditingBindingColumn)
            {
                rgvMain.CellBeginEdit -= RadGridViewCellBeginEdit; // чтобы обработчик не добавлялся два раза
                rgvMain.CellBeginEdit += RadGridViewCellBeginEdit;
                column.Tag = bindingColumn;
            }
 
            columns.Add(column);
        }
         
        void RadGridViewCellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {
            var conditionalEditingBindingColumn = e.Column.Tag as ConditionalEditingBindingColumn;
            if (conditionalEditingBindingColumn == null)
            {
                return;
            }
 
            int columnIndex = -1;
            for (int i = 0; i < rgvMain.ColumnCount; i++)
            {
                if (rgvMain.Columns[i].Name.Contains(conditionalEditingBindingColumn.ConditionName))
                {
                    columnIndex = i;
                    break;
                }
            }
 
            if (columnIndex != -1)
            {
                if ((e.Row.Cells[columnIndex].Value as bool?) == true)
                {
                    e.Cancel = true;
                }
            }
        }
 
        public void AddGridTemplate(RadGridViewTemplate radGridViewTemplate)
        {
            rgvMain.EnableGrouping = false;
            rgvMain.GridViewElement.DrawBorder = false;
            rgvMain.GridViewElement.GroupPanelElement.DrawBorder = false;
            rgvMain.MasterTemplate.AllowColumnChooser = false;
            AddBindingColumnRange(rgvMain.MasterTemplate, radGridViewTemplate.Columns);
 
            AddGridTemplateRecursivly(rgvMain, rgvMain.MasterTemplate, radGridViewTemplate.ChildTemplates);
        }
 
        public List<string> DayOfWeeksGroupHeader { get; private set; }
 
        public void AddGroupHeaderIpr(GridViewTemplate childTemplate, List<string> groupHeaderText)
        {
            DayOfWeeksGroupHeader = groupHeaderText;
            rgvMain.ViewCellFormatting += BoldDaysOfWeekHeader;
            var columnGroupsView = new ColumnGroupsViewDefinition();
            int index = 0;
            int i = 0;
            foreach (var header in groupHeaderText)
            {
                columnGroupsView.ColumnGroups.Add(new GridViewColumnGroup(header));
                columnGroupsView.ColumnGroups[index].Rows.Add(new GridViewColumnGroupRow());
                 
                 
                //Три колонки в одном дне недели
                columnGroupsView.ColumnGroups[index].Rows[0].Columns.Add(childTemplate.Columns[i++]);
                columnGroupsView.ColumnGroups[index].Rows[0].Columns.Add(childTemplate.Columns[i++]);
                columnGroupsView.ColumnGroups[index].Rows[0].Columns.Add(childTemplate.Columns[i++]);
                index++;
 
            }
            childTemplate.ViewDefinition = columnGroupsView;
        }
 
        private void BoldDaysOfWeekHeader(object sender, CellFormattingEventArgs e)
        {
            var c = e.CellElement as GridHeaderCellElement;
 
            if (c != null && DayOfWeeksGroupHeader != null)
            {
                if (DayOfWeeksGroupHeader.Contains(e.CellElement.Text))
                {
                    //                    e.CellElement.DrawBorder = true;
                    //                    e.CellElement.DrawFill = true;
                    //                    e.CellElement.BackColor = Color.LightSalmon;
                    c.Font = new Font(Font,FontStyle.Bold);
                }
            }
        }
 
        private void AddGridTemplateRecursivly(RadGridView forRelations, GridViewTemplate parentTemplate,
            List<RadGridViewTemplate> radGridViewTemplates)
        {
            if (parentTemplate == null || radGridViewTemplates.Count == 0)
            {
                return;
            }
 
            foreach (var template in radGridViewTemplates)
            {
                // add child template
                GridViewTemplate childTemplate = template.ToGridViewTemplate();
                AddBindingColumnRange(childTemplate, template.Columns);
                 
                parentTemplate.Templates.Add(childTemplate);
                parentTemplate.AllowCellContextMenu = false;
                childTemplate.AllowCellContextMenu = false;
 
                //add relation
                GridViewRelation firstRelation = template.Relation.ToGridViewRelation();
                firstRelation.ChildTemplate = childTemplate;
                firstRelation.ParentTemplate = parentTemplate;
                forRelations.Relations.Add(firstRelation);
 
                AddGridTemplateRecursivly(forRelations, childTemplate, template.ChildTemplates);
            }
        }
 
        public class RadRelation
        {
            public RadRelation(string relationName, IList<string> parentColumnNames, IList<string> childColumnNames)
            {
                RelationName = relationName;
                ParentColumnNames = parentColumnNames;
                ChildColumnNames = childColumnNames;
            }
 
            public string RelationName { get; set; }
            public IList<string> ParentColumnNames { get; set; }
            public IList<string> ChildColumnNames { get; set; }
 
            public GridViewRelation ToGridViewRelation()
            {
                var r = new GridViewRelation
                {
                        RelationName = RelationName
                };
                 
                if (ChildColumnNames != null)
                {
                    foreach (string columnName in ChildColumnNames)
                    {
                        r.ChildColumnNames.Add(columnName);
                    }
                }
                 
                if (ParentColumnNames != null)
                {
                        foreach (string columnName in ParentColumnNames)
                    {
                        r.ParentColumnNames.Add(columnName);
                    }
                }
                return r;
            }
        }
 
        #endregion
 
        public void CollapseAll()
        {
            rgvMain.MasterTemplate.CollapseAll();
        }
 
        public void ExpandAll()
        {
            rgvMain.MasterTemplate.ExpandAll();
 
        }
    }
     
    public enum GridSortDirection
    {
        Ascending,
        [UsedImplicitly] Descending,
        [UsedImplicitly] None
    }
}



Sorry for my english :)
George
Telerik team
 answered on 23 May 2014
3 answers
186 views
Hi,

I've got a simple listview with a datasource where i want to control the max width each column. However, I got some fields with a lot of text and therefore implemented TextWrap. The text is wraped fine, but the top of and the bottom of the text is cut off(see attached file). It seems that the itemheight needs to be set??? But where and how??

using 2014.1.226.40
I'm doing the following:

        public void Initialize()
        {
            this.catalogListView.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView;
            this.catalogListView.AllowArbitraryItemHeight = true;
            this.catalogListView.GroupDescriptors.Add(new GroupDescriptor(new SortDescriptor[] { new SortDescriptor("type", ListSortDirection.Ascending) }));
            this.catalogListView.EnableGrouping = true;
            this.catalogListView.ShowGroups = true;
            this.catalogListView.DataSource = DataManager.Instance.GetAllFunctions();
        }


        private void Catalog_Load(object sender, EventArgs e)
        {
            foreach (ListViewDetailColumn c in catalogListView.Columns)
            {
                c.MinWidth = 75;
                c.MaxWidth = 200;
                c.AutoSizeMode = ListViewBestFitColumnMode.AllCells;
                c.BestFit();
            }
        }


        private void catalogListView_CellCreating(object sender, ListViewCellElementCreatingEventArgs e)
        {
            e.CellElement.TextWrap = true;
        }
George
Telerik team
 answered on 23 May 2014
3 answers
504 views
Hi Telerik,

i got a GridView with a ImageColumn

within the cellFormatting event I do the following:

            if (e.CellElement.ColumnInfo is GridViewImageColumn)
            {
                if (e.CellElement.Image == null)
                {
                    if (((GridViewImageColumn)e.CellElement.ColumnInfo).FieldName == "PicturePath")
                    {
                        string strPath = ((GridImageCellElement)e.CellElement).Value.ToString();
                        if (strPath != string.Empty)
                        {
                            e.CellElement.Image = new Bitmap(strPath);
                            e.CellElement.ImageLayout = ImageLayout.Stretch;
                        }
                    }


this works fine basically, but when I get to a certain number of records it gets considerably slow when scrolling (because it has to repaint the grid again....)

I also noticed, when scrolling forward and backwards it randomly places displayed images within the column (even to record who actually dont have an image yet)


Any idea how to improve the performance and how to get around the scrolling issue?

thank you

cheers

Christian
Dimitar
Telerik team
 answered on 23 May 2014
2 answers
129 views
I want to use this control because of the search capability. I want the user to look up an item based off its code or description. This works just fine. Once the user finds the item they want, I need to add it to a grid. This functionality works. Here is the problem. I need to get the value of what's clicked or the value when they hit enter or tab. SelectedIndexChanged fires off on everything. This causes unwanted items to be added to the grid. I only want the items added if the user clicks on it or hits tab or enter. SelectedIndexChanged fires off on up and down arrows and so on. How can I get the value of what's actually clicked? Click and mouseclick do not work because it fires off for the list box click only and not the underlying grid.
Anyone have any ideas on how to only get what the user clicks on and not ever item when SelectedIndexChanged fires?
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 23 May 2014
3 answers
648 views
G'day,

I am using a Telerik WinForms Calendar control, with the footer visible so that I can use the Today button.

Unfortunately, when I click the Today button the control only 'shows' today. FOr example, if I had a date in November 2014 selected the control would only move the visible month to todays month (April 2013). 

My desired behaviour is for the calendar to move the display and ALSO select the date (triggering all the usual SelectedDateChanged events).

Do I need to handle the TodayButton click event? How do I do this? Is this possible in any way?

EDIT: It looks like it adds today's date to the selected dates, instead of replacing the selecteddate with todays date. Is this the designed behaviour?

Kind Regards,
Connect Direct Team
Stefan
Telerik team
 answered on 23 May 2014
7 answers
132 views
Does the richtextbox support header and footer. I tried importing a msword document with an image header. The richtextbox was able to import the entire document including the images on the document correctly. However the image on the header section was not imported.
Stefan
Telerik team
 answered on 23 May 2014
1 answer
274 views
Hi,

How can i select an item by pressing first character on keyboard. I can't find any property for this feature.

Thanks and regards,
Kasi
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 23 May 2014
7 answers
580 views
Can I set font family and size from a FontDialog() for a selected area of text in a RichTextBox? If so, what properties do I need to look for and set? I'm doing this in C#.

Thanks,
Ross
George
Telerik team
 answered on 22 May 2014
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Barcode
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Licensing
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?