Thursday, March 22, 2012

HTML Contents in GridView Rows Will Not Display as HTML?

Hello all,

I am trying to read a directory listing into a string[] and then use
that data, along with some other data, to create HTML for display in a
gridview row. A sample item in the string[] might look like this...

<div style='vertical-align:middle;'><img src='image.jpb'><a
href='somefile.zip'>somefile.zip</a></div
I then bind the array to a gridview to show on the form.

This always worked great with a datagrid in VS2003. Now, however, the
gridview handles the HTML differently: if reformats it? What I mean is,
the HTML displays as literal text...the gridview rows really show the
HTML tags (<div>, etc...). When inspecting the page with the browser's
View | Source, I can see that the page has all of the <div> as < div
>. Why is this happening, and how do I fix it? It would be great if
asp.net would not change my code!

No comments:

Post a Comment