自定义修改GridView的显示文本

当我们在GridView中显示数据时,要将数据库的缩写数据还原成直观的数据给客户,例如:

N-新增,D-删除,C-编辑

选中GridView

以下代码为VB.NET,使用时进行适当修改即可。

Private Sub GridView1_CustomColumnDisplayText(sender As Object, e As DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs) Handles GridView1.CustomColumnDisplayText
        If e.Column.Caption = "修改类型" Then

            If e.Value = "N" Then
                e.DisplayText = "新增"
            ElseIf e.Value = "D" Then
                e.DisplayText = "删除"
            Else
                e.DisplayText = "更新"
            End If
        End If


    End Sub

 

posted on 2016-11-14 11:37  Joey.ZJ  阅读(170)  评论(0编辑  收藏  举报