Try our conversational search powered by Generative AI!

Strange custom property behaviour (adding CDATA)



I've created a custom property which in edit mode has two textboxes. One which is used as a header, and the other one as HTML content.

It consists of two classes,

FooProperty, which inherits PropertyXhtmlString
FooPropertyControl, which inherits PropertyLongStringControl

When saving my data in the overridden ApplyEditChanges, I use a StringBuilder to create a basic xml layout for the data, like so,

  <header>My Header</header>

my html content

]]></content> </foo>

Later when I get the data for editing, my CDATA is now three (3) CDATA's, like so,

<![CDATA[<![CDATA[<![CDATA[<p>my html content</p>]]>]]>]]>
How come? When does this magic happen?
Mar 18, 2010 12:09

Save something in the property, then check tbl_Property in the database.  Is the value correct here, or wrong as you note?  That would at least tell you if the problem is happening on save or retrieval.

Beyond that, I would switch to an XmlTextWriter to create the XML string.  I've used this quite a bit on custom properties and never had a problem with it (though, I was never writing any CDATA sections to my XML).

Apr 17, 2010 16:47

If I were you I would inherit PropertyLongString rather than PropertyXhtmlString. The latter does a lot of processing on it's value that you probably don't need/want anyway, and might be responsible for garbling your data.

Apr 19, 2010 7:29
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.