Wednesday, April 18, 2012

Displaying and editing HTML code in a DataGridView

I have a DataGridView that is bound to a DataSet. The DataSet has its data from an XML file. In the XML file there is one element that contains basic html data (only <p> and <strong>):



<?xml version="1.0" encoding="utf-8"?>
<entries>
<entry>
<desc><![CDATA[[<p>Some <strong>text.</strong></p>]]></desc>
</entry>
</entries>


When I have a DataGridView that has a column bound to this field desc the html gets displayed as string with its tags (<p>Some <strong>text.</strong></p>). When I save this xml back, the tags are converted to their html entities.



How can I display the html code as rich text in the textbox ("Some text.")? I guess I need to make a custom richtextbox column type here but I'm a little bit stuck as beginner. Furthermore the text should be editable with a richtexteditor.



Can someone give me some help on this?





No comments:

Post a Comment