I have a GridView bound to an ObjectDataSource. I\'ve got it supporting editing as well, which works just fine. However, I\'d like to safely HtmlEncode text that is displa
In my case I was forced to use the "Bind" method on mi EditItemTemplate's TextBox because needed the data to be accessible in the NewValues array at the item_Updating event handling. So i figured out as follow:
on my EditItemTemplate :
then in the code behind :
protected void TextBox_PreRender_decode(object sender, EventArgs e)
{
TextBox tb = (TextBox)sender;
tb.Text = WebUtility.HtmlDecode(tb.Text);
}
This solution allowed me to show properly an html-encoded data for all of my TextBoxes and at the same time being able to access this data from the newValues array when the item_Updating event fires.