When using ShowCellLabels, can the label display HTML text?

Posted by: freedom93123 on 16 November 2020, 7:00 pm EST

  • Posted 16 November 2020, 7:00 pm EST


    Currently, I'm using C1FlexGrid with ShowCellLabels=True and C1SuperLabel to render the HTML text in the cell.

    I faced a cosmetic issue where the label with HTML tag is shown when the content of the cell is partially visible as below:

    Is this the current limitation if I use the ShowCellLabels approach?

    Before this, I thought to use C1SuperToolTip instead of ShowCellLabels. However, I found that detecting the length of string exceeds the size of cell is not feasible when the single cell can have multiple lines of text.
  • Replied 17 November 2020, 8:36 pm EST


    the string length is calculated based on the plain HTML string in the cell, and thus the grid thinks that it has to display the cell labels.

    Workaround: you might switch off "ShowCellLabels" in the "C1FlexGrid.MouseMove" event based on the cell below the cursor:

        private void c1FlexGrid_MouseMove(object sender, MouseEventArgs e)
    HitTestInfo hitTest = this.c1FlexGrid.HitTest(e.Location);
    if (hitTest.Column == 2)
    this.c1FlexGrid.ShowCellLabels = false;
    this.c1FlexGrid.ShowCellLabels = true;

    I hope this works - I did not test it ;-).

    Best regards

  • Marked as Answer

    Replied 17 November 2020, 10:52 pm EST


    The ShowCellLabels property is used to show the cell contents that are partially hidden and the actual content of the cell is an HTML string which is rendered using C1SuperLabel so when hovering the cell it is showing the HTML string.
    As a workaround you can use the C1SuperTooltip which renders the HTML, you can set the tooltip in the MouseMove event of the grid and then use the Popup event of the tooltip to only show when the content exceeds the bounds, you can use the Measure() method of the C1SuperLabel to get the Size of the contents. Since its content will word wrap automatically you need to check for the Height to decide whether to show or hide the tooltip.
    Please refer to the sample attached. If you have any further questions, please let me know.

    @Wolfgang, thank you for your suggestions. The method you suggested will work for the normal columns.

    Prabhat Sharma.
  • Replied 19 November 2020, 12:55 am EST

    Thanks @Wolfgang and @PrabhatSharma for the prompt reply.

    I manage to achieve what I need.

Need extra support?

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

Learn More

Forum Channels