C1flexgrid add a new row as a button

Posted by: saidnai on 8 December 2020, 12:14 pm EST

    • Post Options:
    • Link

    Posted 8 December 2020, 12:14 pm EST

    Good day,

    Is there a fine sample in Visual Basic how to add a column as button that hired a click on Event giving back the row number.

    I need to do the following:

    Data will be shown from database in a Flexgrid, the last column will be a button with the Caption = “Closed”. Onclick event i will update the record and refresh the list.

    Thanks for your support.

    Said

  • Posted 9 December 2020, 6:31 am EST

    Hi Said,

    As you want to show the whole cell as a button then you need to host the buttons on the grid, you need to add a button for each row and then you can use the HostedControl class from the Sample “HostControls” (Location: C:\Users\UserName\Documents\ComponentOne Samples\WinForms\v4.5.2\FlexGrid\CS\HostControls) to manage the location and visibility of these controls.

    You can also show in-Built CellButtons in cells of a column by setting its ComboList property to “…” and then handle their clicks using the CellButtonClick event of the grid.

    Please refer to the sample attached.

    If you have any other questions, please let me know.

    Regards,

    Prabhat Sharma.

    FGCellButtons.zip

  • Posted 9 December 2020, 9:17 am EST - Updated 3 October 2022, 11:30 pm EST

    Dear Prabhat,

    Thanks a lot.

    The sample i cannot run because of the lc.exe again.

    I have used the code from the sample in my application. It is running well. The only problem is the Width of the cell, see attached Pictures.

    Where/How can i make it Widther?

    Best regards

    Said

  • Posted 9 December 2020, 9:45 am EST

    Dear Prabhat,

    Thanks a lot. I found it.

            c2.TextAlign = TextAlignEnum.CenterCenter
            c2.Width = 150
    

    Best regards

    Said

  • Posted 9 December 2020, 10:27 am EST - Updated 3 October 2022, 11:30 pm EST

    Dear Prabhat,

    Thanks a lot. I faced another problem. In the event click on the button i update the database and reload the C1Flexgrid, The update record will not shown anymore but it’s button will be kept and shown (See picture attached).

    Best regards

    Said

  • Posted 10 December 2020, 5:22 am EST

    Hi Said,

    You can Handle the AfterDataRefresh event of the grid and then refresh the button list whenever Data is reset or a row is added/deleted. Please refer to the sample attached where I change the data when a cell button is clicked.

    If you have any other questions, please let me know.

    Regards,

    Prabhat Sharma.

    FGCellButtons_Mod.zip

Need extra support?

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

Learn More

Forum Channels