How to insert html content in sql server and asp.net

To Encode the html text and store in sqlserver.

  • string htmlencoded = Server.HtmlEncode(<html>dhaval</html>);
  • Now pass this string as an argument to the method which is used to insert data in sql database.

 

To retrieve from sqlserver or to decode html.

You have to use Literal Control from toolkit.(Id=’literal1′)

  • literal1.Text = HttpUtility.HtmlDecode(htmlencoded);

 

 

Advertisements

One thought on “How to insert html content in sql server and asp.net

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s