[NET6] C1FlexGrid and IEmbeddedEditor with C1DateEdit

Posted by: wknauf on 1 March 2023, 8:36 pm EST

  • Posted 1 March 2023, 8:36 pm EST

    Hi C1,

    attached solution contains two samples for .NET6 and .NET48: a C1.Win.Calendar.C1DateEdit is placed on a UserControl, which is used as C1FlexGrid column editor by implementing “IEmbeddedEditor” (.NET6) or “IC1EmbeddedEditor” (.NET 4.8).

    FlexValidate.zip

    In the .NET6 version, the control value is not applied to the grid cell: click in the cell, change the value by typing a new date, then click outside of the editor.

    In .NET 4.8, it works fine.

    It seems to be a problem of my code in “GetValue”: here I return “C1DateEdit.Value”, which does not contain the new value.

    I could workaround this problem by triggering validation in “IEmbeddedEditor.IsValueValid”:

        public bool IsValueValid()
        {
          //Force validation of the C1DateEdit:
          return this.Validate();
        }

    By the way: I also added PostValidation code to cancel on invalid values, and this is triggered even without my workaround. So the problem is only that the value is not applied to the “Value” picker.

    What do you think? Is this a bug in the control? Or is my workaround necessary in the .NET6 version? Is there even a better workaround?

    Best regards

    Wolfgang

  • Posted 1 March 2023, 10:01 pm EST

    Just an update: The workaround to call “Validate” does not work always. The control behaves differently when using TAB to leave the editor or when clicking outside of it.

    It works best when calling “C1DateEdit.UpdateValueWithCurrentText”

  • Posted 6 March 2023, 2:35 pm EST - Updated 6 March 2023, 2:44 pm EST

    Hi Wolfgang,

    Apologies for the delay in response.

    We could observe the behavior you have mentioned at our end. As per our investigation, it seems the PostValidating event of C1DateEdit in NET6 is called after the FlexGrid calls the GetValue method to get the value from the editor. We have escalated the issue to the development team. We will update you as soon as we have any updates.

    [TrackingID : [C1WIN-29240]]

    In the meantime, as a workaround, you can use the UpdateValueWithCurrentText method in the IsValueValid(), since the grid calls IsValueValid() before the GetValue(), the value will be updated before it is fetched by the grid.

    Regards

    Avnish

Need extra support?

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

Learn More

Forum Channels