Hi Ken,
In this case, I'd use a helper function and some nice built-in
functionality.
Pass your raw string into the helper function, process it and display the
changed version.
I've inserted a sample below that should get you going.
Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
Toronto
<asp:datagrid id="DataGrid1" runat="server"
autogeneratecolumns="False">
<columns>
<asp:templatecolumn HeaderText="StringValue">
<itemtemplate>
<asp:Label runat="server" Text='<%#
MakeTitleCase( DataBinder.Eval(Container, "DataItem.StringValue")) %>'>
</asp:label>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
DataGrid1.DataSource = CreateDataSource()
DataGrid1.DataBind()
End If
End Sub
Function MakeTitleCase _
(ByVal strIn As String) As String
Dim myTI As System.Globalization.TextInfo = _
New System.Globalization.CultureInfo("en-CA", False).TextInfo
Return myTI.ToTitleCase(strIn)
End Function
Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "george smith" + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function
http://msdn.microsoft.com/library/d...lobalizationtextinfoclasstotitlecasetopic.asp