We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom DateTimePicker cell in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

130491 May 16,2017 01:32 AM UTC May 18,2017 04:17 AM UTC Windows Forms 3
loading
Tags: GridGroupingControl
hieudt
Asked On May 16, 2017 01:32 AM UTC

Hi,

I want to add some properties like ResetSelectionOnFocus, AutoForwarding, NullString, IsNullDate, NullModeKeyReset. How can I do this ? I have attached a sample

Thanks.

Attachment: DateTimePickerAdvSample_acee4da8.rar

Mohanraj Gunasekaran [Syncfusion]
Replied On May 16, 2017 01:07 PM UTC

Hi Hieudt, 
 
Thanks for using Syncfusion product. 
 
By default, GridGroupingControl does not have the support to add the custom properties for DateTimePickerAdv. But you can add the custom properties in DateTimeCellModel or DateTimeCellRenderer by using the CustomCellModel and CustomCellRenderer which has derived from the DateTimeCellModel and DateTimeCellRenderer. Please refer to the below code example, 
 
Code example 
gridGroupingControl1.TableModel.CellModels.Add("DateTimePicker", new CustomDateTimeCellModel(gridGroupingControl1.TableModel)); 
            this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.CellType = "DateTimePicker"; 
 
GridCellRendererBase renderer = this.gridGroupingControl1.TableControl.CellRenderers["DateTimePicker"]; 
CustomDateTimeCellRenderer dateTimeCellRenderer = renderer as CustomDateTimeCellRenderer; 
 
public class CustomDateTimeCellModel : DateTimeCellModel 
{ 
    /// <summary> 
    /// Initializes a new instance of the <see cref="Syncfusion.GridHelperClasses.DateTimeCellModel"/> class. 
    /// </summary> 
    /// <param name="grid">The grid model.</param> 
    public CustomDateTimeCellModel(GridModel grid) 
        : base(grid) 
    { 
    } 
 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new CustomDateTimeCellRenderer(control,this); 
    } 
 
} 
 
public class CustomDateTimeCellRenderer : DateTimeCellRenderer 
{ 
    public CustomDateTimeCellRenderer(GridControlBase grid, GridCellModelBase cellModel) 
        : base(grid, cellModel) 
    { 
        grid.Controls.RemoveAt(1); 
        grid.Controls.Add(new CustomDateTimePicker()); 
    } 
 
    public string Property1 
    { 
        get; 
        set; 
    } 
 
} 
 
 
Screenshot 
 
 
Sample link: GridGroupingControl 
 
Regards, 
Mohanraj G 
 


hieudt
Replied On May 17, 2017 02:44 AM UTC

Hi,

Thanks for your support. I will try it and ask you later

Mohanraj Gunasekaran [Syncfusion]
Replied On May 18, 2017 04:17 AM UTC

Hi Hieudt, 
 
Thanks for your update. 
 
We will wait until here back from you. 
 
Regards, 
Mohanraj G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;