This is a migrated thread and some comments may be shown as answers.

Cell format

2 Answers 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JustinWong
Top achievements
Rank 1
JustinWong asked on 15 Apr 2010, 06:21 AM
Hi

Is there a way to format a portion of the text within a cell in the textbox column. For example, I just want a particular word within the cell to be bold and in red, and the rest in regular font and in black.  Kind'a like a rich text.  I know it's a lot to ask, but it would be great if acheiveable.

Thanks!

Justin

2 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 15 Apr 2010, 09:34 AM
Hello JustinWong,

Yes, you can achieve this by using the html text formatting capability. You can read more about that in this documentation article. You can format the cell text in the CellFormatting event. Before you format the cells of the specified column, however, you should set its DisableHTMLRendering property to false. You can use the following code snippet as sample:

this.radGridView.Columns["Column"].DisableHTMLRendering = false;

private void radGridView_CellFormatting(object sender, CellFormattingEventArgs e)
{
    GridViewDataColumn dataColumn = e.CellElement.ColumnInfo as GridViewDataColumn;
    if (dataColumn != null && dataColumn.UniqueName == "Column")
    {
        e.CellElement.Text = "<html>Your text is <b>bold</b></html>";
    }
}

If you have further questions feel free to write us back.

Greetings,
Svett
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
JustinWong
Top achievements
Rank 1
answered on 15 Apr 2010, 04:27 PM
Wayyyyy cool - thanks!
Tags
GridView
Asked by
JustinWong
Top achievements
Rank 1
Answers by
Svett
Telerik team
JustinWong
Top achievements
Rank 1
Share this question
or