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''m trying to change the size of a grid to a single cell (ncluding row/col borders) if there is no data, but it isn''t working. What is wrong with this code (what am I missing) :
if (numDefects == 0)
{
this.gridCtl.BeginUpdate();
int [,] grid = new int[2, 2];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
grid[i,j] = 0;
this.gridCtl.Model.PopulateValues(
GridRangeInfo.Cells(0, 0, 2, 2), grid );
this.gridCtl.EndUpdate();
this.gridCtl.Refresh();
this.gridCtl.Invalidate();
return;
}
ADAdministrator Syncfusion Team June 29, 2006 09:33 PM UTC
Hi Michael,
The Populate method gives you an easy way to copy the data from any given datasource that implements the IList interface or is an Array to the specified range of cells in the Grid. It doesn''t configure the grid (ie it doesn''t set the RowCount/ColCount/Style property of the grid). If you want to configure the grid, you can set those property explictly. Here is a code snippet.
if (numDefects == 0)
{
this.gridCtl.BeginUpdate();
int [,] grid = new int[2, 2];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++)
grid[i,j] = 0;
this.gridCtl.Model.PopulateValues(
GridRangeInfo.Cells(0, 0, 2, 2), grid );
//Set the RowCount AND Colcount
this.gridCtl.RowCount = 1;
this.gridCtl.ColCount = 1;
this.gridCtl.EndUpdate();
this.gridCtl.Refresh();
this.gridCtl.Invalidate();
return;
}
Let me know if this helps,
Best Regards,
Haneef