【发布时间】:2012-02-08 07:26:04
【问题描述】:
我有一个未绑定的 Gridview,它由 Linq to Entities 查询填充,并且希望将特定列中的字符串值转换为小写。
在 Gridview 的 RowDataBound 事件中,我尝试了 StrConv(e.Row.Cells(3).Text, VbStrConv.ProperCase) 但这不起作用。
我还在 LiNQ to Entities 查询中尝试了StrConv(emp.Name, VbStrConv.ProperCase),但返回的 Name 值仍然要转换为小写。
Protected Sub GridView3_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView3.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
For i As Integer = 0 To e.Row.Cells.Count - 1
Dim cellDate As Date
If Date.TryParse(e.Row.Cells(i).Text, cellDate) Then
e.Row.Cells(i).Text = String.Format("{0:d}", cellDate)
End If
Next
End If
StrConv(e.Row.Cells(4).Text, VbStrConv.ProperCase)
End Sub
【问题讨论】:
标签: asp.net vb.net gridview linq-to-entities