The first is to use the DataFormatString property in the column itself. In addition, you can use the NullDisplayText field to set a value to be displayed if the data value is null. However, this will only give you limited options on formatting, especially if you're looking at an empty string, which is different than a null value.
The second option, and the one I'd suggest, would be to move your text formatting to the codebehind page and consume the ItemDataBound event. By putting things in the code behind, you have a lot more flexibility in determining what will be displayed to the user, plus you don't have to go into source view on the aspx page when you're trying to debug formatting issues.
Here's a sample of how a method would work.
private void FormatGrid(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
DataRow drData;
// The layout of the grid cells is as follows:
// 0 - ID
// 1 - Level
// 2 - Timestamp
// 3 - Source
// 4 - Message
// 5 - Exception
// Only work with data rows
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Get corresponding datarow for row we are binding.
drData = ((DataRow)(((System.Data.DataRowView)(e.Row.DataItem)).Row));
if (!(drData.IsDBNull(drData.Item(2)))
{
e.Row.Cells(2).Text = drData.Item(2).ToString();
}
else
{
e.Row.Cells(2).Text = "Not Available.";
}
}
}