Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to display a readonly HTML formatted text in Grid cells

$
0
0

This example illustrates how to create a custom editor to display a readonly HTML formatted text. In standalone mode you can use the LabelControl instead.

To show the HTML formatted text in a grid you can assign the RepositoryItemRichTextEdit to an appropriate column. However, the RichEditControl is quite a complex and "heavy" control. So, if you only need to show the HTML formatted text in the grid without editing it the best way to get it done is to assign a custom RepositoryItemHtmlLabel to a column. Note that the HtmlLabelViewInfo implements the IHeightAdaptable interface. So, this custom control supports the word wrapping feature and grid's row auto height feature will work properly.

Question Comments

Added By: Anders Wang at: 9/26/2015 1:06:06 AM    

Hi
How to make the text in the cell can be selected? Thanks.

Added By: Andrew Ser (DevExpress Support) at: 9/28/2015 12:39:31 AM    Hello Anders,
I've extracted your inquiry into a separate thread - How to display selectable HTML text in grid cells. Let's discuss this question there.Added By: Valeria Avramova at: 4/11/2018 6:16:55 AM    I cannot use the LabelControl for this. The documentation says the Label control works for href but not any other text. The comment above saying it supports ReadOnly HTML is misleading.Added By: Svetlana (DevExpress Support) at: 4/11/2018 1:43:34 PM    

Hi, 

Our LabelControl supports simple HTML tags as described in the HTML Text Formatting help article. We also have a special HyperlinkLabelControl as your aim is to show text or a portion as a hyperlink. 


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>