Hello,
It has been awhile since I have manipulated data in a Gridview. I am binding an collection to a Gridview and one of the values contains non-html line breaks (\n). I would like to convert these to html line breaks (<br />). The code below works fine.
protected void gridHistory_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if (e.Row.RowType == DataControlRowType.DataRow)
{
row.Cells[0].Text = row.Cells[0].Text.Replace("\n", "<br />");
}
}Is there an "easier"/"better" way of doing it?
Thanks.
Tod Birdsall, MCSD for .NET
blog:
http://tod1d.net