Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ReportGridView.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim TitleCaseFields() As String = {"FieldName1", "FieldName2"}
For Each GridDataControlFieldCell As DataControlFieldCell In e.Row.Cells
Dim GridBoundField As BoundField = GridDataControlFieldCell.ContainingField
Dim GridDataField As String = GridBoundField.DataField
If TitleCaseFields.Contains(GridDataField) = True Then
GridDataControlFieldCell.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Server.HtmlDecode(GridDataControlFieldCell.Text.ToLower))
End If
Next GridDataControlFieldCell
End If
End Sub
Tips and tricks for .NET using ASP and VB code.
Convert the first letter of each word to uppercase in some columns of a gridview
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment