We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Changing Column Format

Hi, I have a table in a dataset, that was filled with a datadapter, and then bounded to a GridListcontrol. I wish to format one specific column in the grid as currency (the data type in the table is double). I tried to do: grdLst.Grid.ColStyles["Value"].Format= "C"; but this doesn't work. How do I do this ? Thank you,

1 Reply

AD Administrator Syncfusion Team March 11, 2003 05:37 PM UTC

The Grid in a GridListControl is a virtual grid. To set any of the styles, you will need to handle the PrepareViewStyleInfo event and set the style there.
 grdLst.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(PVSI);

//....             

private void PVSI(object sender, GridPrepareViewStyleInfoEventArgs e)
{
    if( e.ColIndex == 2 && e.RowIndex > 0)
        e.Style.Format = "C";
}
            

Loader.
Live Chat Icon For mobile
Up arrow icon