Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HtmlDecode in Gridview selected row to textbox 1

Status
Not open for further replies.

kholladay

Programmer
Sep 4, 2005
2,292
US
I am writing data to SQL using something like this as part of a SQL INSERT command

myCommand.Parameters("@ContactNote").Value = Server.HtmlEncode(tbNote.Text)

Then I want to be able to select an item out of a GridView to populate the contents of the TextBox so I've used this

tbNote.Text = Server.HtmlDecode(row.Cells(1).Text)

I don't get any errors however if I use any characters that were encoded such as the & I get back the $amp; instead.

Any help is greatly appreciated.

Kyle Holladay / IPOfficeHelp.com
ACSS/ACIS/APSS Avaya SME Communications
APDS Avaya Data
MCP/MCTS Exchange 2007/2010
Adtran ATSA, Aruba ACMA

"Thinking is the hardest work there is, which is the probable reason why so few engage in it." - Henry Ford
 

If the Gridview is using BoundField objects, try setting the HtmlEncode property to false:
Code:
 <asp:boundfield datafield="ContactNote" htmlencode="false" headertext="Note" />


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
PERFECT! That did it!!!

Thank you very much.

Kyle Holladay / IPOfficeHelp.com
ACSS/ACIS/APSS Avaya SME Communications
APDS Avaya Data
MCP/MCTS Exchange 2007/2010
Adtran ATSA, Aruba ACMA

"Thinking is the hardest work there is, which is the probable reason why so few engage in it." - Henry Ford
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top