0

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?

David Hall
  • 32,624
  • 10
  • 90
  • 127
acme
  • 14,654
  • 7
  • 75
  • 109
  • You may try using any rich textbox editor, e.g. with jquery plugin http://stackoverflow.com/questions/9159965/jquery-minimal-rich-textbox-plugin – the_joric Apr 18 '12 at 13:02
  • I'd personally look at some sort of master-detail design rather than a rich textbox column. Even if there were an out of the box rich textbox column, I imagine the user experience would never be that great. Instead I'd show all the standard grid style data in the datagridview and have a separate rich textbox below the grid for editing the xml data. – David Hall Apr 18 '12 at 13:07
  • Oh, and I also just added the winforms tag - pretty sure this is correct since datagridview is a winforms control. Sorry if that was wrong. – David Hall Apr 18 '12 at 13:08
  • @David, I think you are right. The user experience of editing a richtextbox within a DataGridView is rather bad, so I followed your hint on providing a separate edit mask. However, I'm also stuck here. See: http://stackoverflow.com/questions/10224556/how-to-edit-a-dataset-in-a-new-form – acme Apr 19 '12 at 08:45

1 Answers1

0

I ended up not doing this. It's not a good user experience to have a RichTextBox right in the DataGridView. I finally made it a regular text field that is editable in a separate form.

acme
  • 14,654
  • 7
  • 75
  • 109