c1FlexGrid editor update column on typing

Posted by: beheerder on 23 February 2018, 10:32 am EST

    • Post Options:
    • Link

    Posted 23 February 2018, 10:32 am EST

    Hi,

    I am using the c1FlexGrid control in a Windows Forms Application. (VB.NET)

    The user fills out a Parameter Number, and on typing this number, i want to update the description column if a description is found in the database based on the parameter number filled out.

    For example:

    Parameter Number 1 = Description A

    Parameter Number 10 = Description B

    I tried to use the ChangeEdit event to capture the editor input. This works, but , it doesn’t update the description. To solve this im am calling FinishEditing, so i can change the description column.

    Now i want the user to be able to continue typing, because maybe he wants to type 10 instead of 1. To solve this i am calling StartEditing, but then the current value 1 is selected and if the user continues typing, the current value will be overwritten. This way it is impossible for the user to type 10. (if a user types 10, only 0 will stay because 1 is overwritten by 0)

    Is there a way to solve this?

    Thanks.

  • Posted 26 February 2018, 2:15 am EST

    Hello!

    Yes, you can use ChangeEdit event in this scenario.

    • In ChangeEdit event, for ‘Parameter Number’ column, you can get the grid’s editor value using C1FlexGrid.Editor.Text (This is the value entered by the user).

    • Next, you can fetch the corresponding Description value from the data source.

    • Now, you simply need to assign this fetched value to the Description column of the grid in the current row. For this, you can do something like this :

    C1FlexGrid1(C1FlexGrid1.Row, *DescriptionColumnIndex*) = *DescriptionValue*
    

    In case you need any further help on this, let me know.

    Best regards,

    Meenakshi

  • Posted 27 February 2018, 6:04 am EST

    Hello,

    I know i can use the ChangeEdit event, but my problem is described in the last paragraph. I want the user to be able to continue typing, so when the user types 1 (the description of 1 must show) and when user continues typing 0 it has to show the description of parameter 10.

    Due to the FinishEditing and StartEditing which are called in the ChangeEdit event, the user overwrites the first typed 1 with 0. So i end up with 0 instead of 10. The StartEditing causes the problem because it will select the current value by default. (so on typing 2nd number, it will overwrite first typed number)

    Ik hope it can be fixed somehow.

    Thanks

  • Posted 28 February 2018, 12:09 am EST

    Hello!

    It should work without using FinishEditing and StartEditing in your scenario. In ChangeEdit event, you need to fetch description value from the database for the currently entered text (i.e. parameter value). And, you can simply assign this description value to any other cell.

    It will change the description content without exiting edit mode in current parameter cell.

    Hope this clarifies. If you still face any issue, feel free to ask. You can also share a stripped-down sample showing the issue.

    Best regards,

    Meenakshi

  • Posted 28 February 2018, 8:57 am EST

    Hi Meenakshi!

    Thank you for your quick reply.

    Your answer (about FinishEditing not needed) moved me into the right direction.

    I found the problem; there was another event fired during the ChangeEdit Event. This event was setting the description to nothing. After changing this event, everything worked perfectly!

    Best Regards,

    Willy

  • Posted 28 February 2018, 11:13 pm EST

    Hi Willy!

    Glad to know that the issue is resolved :slight_smile:

    Best regards,

    Meenakshi

Need extra support?

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

Learn More

Forum Channels