Format a column in a Syncfusion's GridGroupingControl

I have a Syncfusion's GridGroupingControl.

I try to format a column in a custom format.

My column values are like "000123" and I would like to display it like "123"(removing leading zero, or, what is the same, display just first 3 chars that corresponds to the decimal format "D3")

I tried the following code that does not work:

private void ggcResult_DataSourceChanged(object sender, EventArgs e)
{
    if (ggcResult.TableDescriptor.Columns.Contains("MY_COL"))
    {
        var col = ggcResult.TableDescriptor.Columns["MY_COL"];
        col.Appearance.AnyCell.Format = "D3";
    }
}

Or is too late or too soon, anyway, the column is displayed like "000123"...

Answers


I've found the solution ot my problem... It was in the FORMAT of the column data... considered to be as "String", but "string" can't be formatted like an "int" to the "D7" format.

So the solution was to change that format:

private void ggcResult_DataSourceChanged(object sender, EventArgs e)
{
    if (ggcResult.TableDescriptor.Columns.Contains("MY_COL"))
    {
        var col = ggcResult.TableDescriptor.Columns["MY_COL"];
        // setting the type for corresponding format --------------
        col.Appearance.AnyCell.CellValueType = typeof(int);
        col.Appearance.AnyCell.Format = "D3";
    }
}

Need Your Help

wordpress mysql - delete all custom post type

mysql sql database wordpress

I've got a wordpress/mysql set up using the 'custom post type' which currently holds about 40,000 rows of data in the wp_posts table of the database. I'm trying to work on an SQL query that will ...

GridView - Search. Error converting data type nvarchar to int

c# asp.net gridview

My GridView was fine, but then I added a search. I'm having issues with it.