Hi all, I need to perform some string manipulation to a columns contents in a GridView, and I'm using the DataBinding event for the template field for this. I'm converting all Environment.NewLine's to
's for outputting.
Here is the code:
protected void Label1_DataBinding(object sender, EventArgs e)
{
Label lb = (Label)sender;
lb.Text.Replace(Environment.NewLine, "<br />");
}
But it doesn't work. But interestingly, if I assign it to a string like so:
protected void Label1_DataBinding(object sender, EventArgs e)
{
Label lb = (Label)sender;
string outputtest = lb.Text.Replace(Environment.NewLine, "<br />");
Response.Write(outputtest);
}
It writes the correct, newly modified, string at the top - but why isn't it feeding back to the grid view?