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

[Solved] Show Text only in GridHTMLEditorColumn

2 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 02 Jul 2009, 12:17 PM
How can I stop the GridHTMLEditorColumn from showing the rendered HTML when the rows are displayed in the Grid?  If I have links to images within my HTML in the cell, it renders and adds to load time.  I would like to only display the HTML code in that cell.  So for example, even in the case of the cell containing the HTML: <strong>Test</strong>.  I would like the cell to contain <strong>Test</strong> rather than rendering the HTML and ending up with a bolded "Test".  Thank you!

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 02 Jul 2009, 01:35 PM
Hi,

I guess you need to display the content with html tags in the grid,  for this you can hook the itemDataBound and encode the text  as show below .

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            item["Htmltags"].Text= Server.HtmlEncode(item["Htmltags"].Text);
        }
}

Thanks
Princy


0
Todd
Top achievements
Rank 1
answered on 03 Jul 2009, 03:22 AM
Worked perfectly...thank you!
Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Todd
Top achievements
Rank 1
Share this question
or