I entered the text "J&K"(Without Cotes) in my StateCode textbox and saved it into database(SqlServer). But it saved as J & amp; K. So m not able to fetch the data saved, with J&K(Primery key). How can I disable encoding of text before saving it to database?

有帮助吗?

解决方案

You can use the HttpUtility.HtmlDecode Method to remove the encoding.

其他提示

Use Server.HtmlEncode("YourTextWith<and>Characters") for this activity.

wrap your output text within it.

Or,

This can also be helpfull>>

System.Web.UI.HtmlControls.HtmlTextArea textBox = new System.Web.UI.HtmlControls.HtmlTextArea();
textBox.Value = "j&k";

Hope its helpful.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top