我有一個未綁定的Gridview,它由Linq to Entities查詢填充,並希望將特定列中的字符串值轉換爲小寫。我試過StrConv(e.Row.Cells(3).Text, VbStrConv.ProperCase)
,但這不起作用。在運行時將未綁定的Gridview列值轉換爲小寫
我也在LiNQ to Entities查詢中嘗試過StrConv(emp.Name, VbStrConv.ProperCase)
,但仍然返回的名稱值將轉換爲小寫。
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
我已經添加了代碼。下面的代碼行不能按預期工作,即將Cell(4)中的值更改爲小寫的StrConv(e.Row.Cells(4).Text,VbStrConv.ProperCase) – StackTrace 2012-02-08 11:05:22
謝謝,您的代碼執行此操作。 – StackTrace 2012-02-08 12:00:53