I have a GridView control. Each row has a textbox with a description I need. When I pull back the description I see that the (") has been encoded:
TextBox selectedRowTextbox = (TextBox)selectedRow.Cells[5].Controls[1];
string selectedRowText = selectedRowTextbox.Text;
The result:
24" Sparkle Disco Ball
I have tried:
- Server.HtmlDecode
- Regex.Unescape
- Uri.UnescapeDataString
- Regex.Replace
What I would expect is this:
24" Sparkle Disco Ball
Any help would be greatly appreciated.
2
Answers
I figured out what I was doing wrong. Visual Studio displays string values containing double quotes and backslashes like this in my example. That's not a great thing to do IMHO.
You can use the
HttpUtility.HtmlDecode
method to decode the text.