Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: ASP.NET
Expertise: Intermediate
Jun 28, 2005

Forcing HTML Data to Render Properly

If the data in your database looks like "<b>SomeValue</b> or other HTML, you have to do something to prevent the browser from showing the tags, when you want just to display the HTML. Here's how to do it:
    
    under <asp:GridView>--> <Columns>
        <asp:TemplateField>
        <ItemTemplate>
          <table width=100% border=0 cellPadding=0 cellSpacing=0>
          <tr>
          <td width=100% runAt=server id="cellNotes" InnerHtml='<%#Eval("notes")%>'></td>
          </tr>
          </table>          
        </ItemTemplate>
        </asp:TemplateField>
</code></pre>
"Notes" is a field name in the table containing HTML data.

Author's Note: This tip is applicable only in ASP.NET 2.0.

Jaya Nehru Kumar
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap