Skip to main content

Comma seperator

Comments

1 comment

  • Dapfor Team

    Hi,

    You can do it with custom formatting. Formats are objects, indicating the grid how to display values in cells. By default if a format is not specified, the grid calls Object.ToString(). But this can be changed with formats. Each format has 3 methods: Format, Parse & CanParse(). Two last methods are used in edit operations to transform text to a real value (for ex. when user tapes text in a textbox). In your case you should implement only Format() method. The best way to apply the format is Column.Format property.

    Here is an example:

     

    class CustomFormat : Dapfor.Net.Formats.IFormat 
    {
    public string Format(IDataField dataField)
    {
    //your custom formatting
    string formattedString = string.Format(System.Globalization.CultureInfo.InvariantCulture,
    "{0}",
    dataField.Value);
    return formattedString.Replace(".", ",");
    }

    public bool CanParse(string text, IDataField dataField)
    {
    return false;
    }

    public void Parse(string text, IDataField dataField)
    {
    }
    }

    //Set the format:
    grid.Headers[0]["some column"].Format = new CustomFormat();

     

    Best regards,
    Dapfor

    0

Please sign in to leave a comment.

Powered by Zendesk