Labels

Saturday, November 24, 2012

How to Show HTML content or Code Behind Code or SQL Code in Web Page with all Formatting like Font, Font Size, Color etc.


Normally if you paste any content in .NET TextBox control then it will be saved as plain text. To solve this problem you must have to paste data in your HTML control and save it. Although this editor captures all font information but it does not capture color information of .NET code or any code. Now to solve this problem you must have to paste it in MS WORD and then copy and paste it again to your HTML editor control.

Here Describes the process of Showing HTML content or Code Behind Code or SQL Code in Web Page with all Formatting like Font, Font Size, Color etc.

Step 1:
Copy your code to Microsoft Word.




Step 2:
Now Just again copy the content of your word using ctrl+A, ctrl+C

Step 3:
Open Any HTML Editor like Ajax HTML Editor or FCK Editor and Paste the code in it and save this control data it your database.

Step 4:
Now fetch this data from database and show it in your webpage in DIV control. Use innerHTML to show in your Page.
div1.InnerHtml = ds.Tables[0].Rows[0][0].ToString();

Output:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>