This worked great. I did have an issue getting the ID of the column to change. So I wrote a procedure to get column id by Name.
In my case I was looking for "Path" as my column name.
protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var firstCell = e.Row.Cells[GetColumnIndexByName(e.Row,"Path")];
firstCell.Controls.Clear();
firstCell.Controls.Add(new HyperLink { NavigateUrl = firstCell.Text, Text = "Click Here", Target = "_blank" });
}
}
private int GetColumnIndexByName(GridViewRow row, string columnName)
{
int columnIndex = 0;
int foundIndex = -1;
foreach (DataControlFieldCell cell in row.Cells)
{
if (cell.ContainingField is BoundField)
{
if (((BoundField)cell.ContainingField).DataField.Equals(columnName))
{
foundIndex = columnIndex;
break;
}
}
columnIndex++;
}
return foundIndex;
}