Search code examples
asp.nethtml-encode

How to stop gridview column from automatically encoding html entities


I am fairly new to asp.net and come into a problem whilst using a gridview.

I have added some entries that contain the "&" symbol eg "PR Murphy & Associates". I haven't done any encoding of my data prior to inserting it into the database.

When the gridview is changed to edit mode my text looks like this: "PR Murphy & Associates"

Is thee a ny way I can stop it from encoding the information, I mean just keep the text as "PR Murphy & Associates" when inserting and then after/during an edit.

Thanking you


Solution

  • In the GridView's menu, you can select the column and under the properties for that column you can set HTMLEncode to False (or True depending upon your needs).