The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I want to format the cellvalue to the format like #.000. I tried several events, like QueryCellInfo.., it did not work. Please see the attached example code, and see what''s the problem. Thanks.
ADAdministrator Syncfusion Team March 15, 2006 11:38 AM UTC
Hi Hui,
This happens, because the ( e.Style.CellValue = dt.Rows[e.RowIndex - 1][e.ColIndex – 1] ) value of the datatable that is assigned to the cellvalue becomes a string by default. This causes the format not to be assigned. You can avoid this, by converting the value to double. Here is the code snippet.
private void gridControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if (e.RowIndex > 0 && e.ColIndex >= 4 )
{
e.Style.CellValue = Convert.ToDouble(dt.Rows[e.RowIndex - 1][e.ColIndex - 1]);
e.Style.Format = "##.000";
}
}
Let us know if this helps.
Best regards,
Madhan.
HZHui ZhongMarch 15, 2006 05:06 PM UTC
Thanks. It worked.
>Hi Hui,
>
> This happens, because the ( e.Style.CellValue = dt.Rows[e.RowIndex - 1][e.ColIndex – 1] ) value of the datatable that is assigned to the cellvalue becomes a string by default. This causes the format not to be assigned. You can avoid this, by converting the value to double. Here is the code snippet.
>
> private void gridControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
>{
> if (e.RowIndex > 0 && e.ColIndex >= 4 )
> {
> e.Style.CellValue = Convert.ToDouble(dt.Rows[e.RowIndex - 1][e.ColIndex - 1]);
> e.Style.Format = "##.000";
> }
>}
>
>Let us know if this helps.
>
>Best regards,
>Madhan.