Product Review with html

Dec 8, 2010 at 7:24 PM

How can you display Product Review comments in the ListView when they include html markup?

The AjaxControlToolkit HTMLEditor on the AddReview page enables a comment to be "marked up" with style data which gets saved to the database.  That "marked up" comment then does not display correctly in the ListView of the ProductDetails page.  Instead it just displays a cell with both the text content and the mark up like so:

<span style="font-weight: bold">This product </span><span style="background-color: #ffff00; font-style: italic; font-family: georgia,times new roman,times,serif; font-size: 24pt; text-decoration: underline">rocks</span>

 

 

 

Coordinator
Dec 8, 2010 at 11:13 PM

I suppose you could turn off request validation and just use the html, but you really shouldn't let untrusted users input markup.

Dec 9, 2010 at 3:20 PM
Edited Dec 9, 2010 at 6:41 PM

Yes, I would think you don't want the editor to allow any html.  Only way I could find is to use something like this:   http://dotnetperls.com/remove-html-tags 

which will strip away the tags from the UserComment.Content in the ReviewAddBtn_Click event before the db.SaveChanges()

 

 I added the following css and set the editor css to = CustomEditorStyle.  it has NO effect in this application ... but it works if I clone it in a different  web application.   Why?

 .CustomEditorStyle
{
Border-Color:#0066FF;
Border-Style:solid;
Border-Width: thick;
}

.CustomEditorStyle .ajax__htmleditor_editor_toptoolbar {
           display:none;
}

.CustomEditorStyle .ajax__htmleditor_editor_bottomtoolbar {
    display:none;
}

 

 

 

 

 

 

 

 

 


Dec 13, 2010 at 1:24 PM

It works once I cleared the browser cache.