0

I have a column that retrieves date time from a database, now I want to display "Publish Date: 01/01/2019" instead of "01/01/2019" without changing the data type or data source. I know I have to do something with DataView, but I didn't know how to change the DataView value.

Help me please, thank you!

private async Task loadData()
    {
        if (_ct == null)
            _ct = new CancellationTokenSource();

        if (bookDAL == null)
            bookDAL = new BookDAL();

        var _tb = await bookDAL.loadDataAsync(_ct.Token);
        c1FlexGrid1.DataSource = _tb;

        c1FlexGrid1.AllowAddNew = true;
        c1FlexGrid1.NewRowWatermark = "Add new row";

        DataView view = new DataView(_tb);

        var dateColumn = c1FlexGrid1.Cols["PublishDate"];
    }
QuangGiap
  • 63
  • 5

1 Answers1

0

You can override function:

    public override string GetDataDisplay(int row, int col, out Image img, out CheckEnum chk)

and return value to display on cell, for example:

public override string GetDataDisplay(int row, int col, out Image img, out CheckEnum chk)
    {
        var result = base.GetDataDisplay(row, col, out img, out chk);
        if (this.Cols[col].Name == "PublishDate")
        {
            result = "Publish Date: " + result;
        }

        return result;
    }