How to Prevent C1DateEdit from Auto Filling Date on Mouse Click

Originally Posted 18 November 2016, 8:49 pm EST

  • Originally Posted 18 November 2016, 8:49 pm EST

    Hello,

    Using version 4.0.20163.212 of controls.

    How does one prevent mouse click from auto populating the current datetime in C1DateEdit control?

    I cannot figure out how to accomplish this and need to have this behavior turned off.

    Thank you,
    Gregg
  • Reply

    Hi Gregg,

    As of now you could implement this by extending C1DateEdit control and overriding its OnMouseDown method. There is no other way to accomplish this.

    public class ExtendedC1DateEdit : C1.Win.C1Input.C1DateEdit
    {
    protected override void OnMouseDown(MouseEventArgs e)
    {
    if(this.Value.ToString().Trim().Length > 0)
    base.OnMouseDown(e);
    }
    }


    Now you can drop down ExtendedC1DateEdit control on your from toolbox once the project is rebuilt.

    ~nilay
  • Marked as Answer

    Reply

    Thank you Nilay.

    That works as we are already using an inherited version of the C1DateEdit control in our projects.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels