Protected Sub gvForecast_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvForecast.RowDataBound
Dim ea As GridViewRowEventArgs = TryCast(e, GridViewRowEventArgs)
Dim iCount As Integer
If ea.Row.RowType = DataControlRowType.DataRow Then
Dim drv As DataRowView = TryCast(ea.Row.DataItem, DataRowView)
'only add it to percentage columns
For iCount = 7 To 18
Dim bf As BoundField = DirectCast(gvForecast.Columns(iCount), BoundField)
If sViewType = "Percent" Then
bf.DataFormatString = "{0:P0}"
Else
bf.DataFormatString = ""
End If
Next
End If
End Sub
|