I
Iain
Hi all
I have a datagrid in a web form and I want to be able to determine the
width of the datagrid at runtime.
I have tried both of the following
// Get the width using the datagrid width attribute.
double datagridWidth = 0;
datagridWidth = dgProjects.Width.Value;
and
// Add the widths of all columns
double dgWidth = 0;
for (int i = 0; i <= dgProjects.Columns.Count - 1; i++)
{
dgWidth = dgWidth + dgProjects.Columns
.ItemStyle.Width.Value;
}
Neither of these returns the width. All values are 0.0.
Is there any kind soul out there who knows how to do this.
Many thanks in advance for any assistance offered
Iain
I have a datagrid in a web form and I want to be able to determine the
width of the datagrid at runtime.
I have tried both of the following
// Get the width using the datagrid width attribute.
double datagridWidth = 0;
datagridWidth = dgProjects.Width.Value;
and
// Add the widths of all columns
double dgWidth = 0;
for (int i = 0; i <= dgProjects.Columns.Count - 1; i++)
{
dgWidth = dgWidth + dgProjects.Columns
.ItemStyle.Width.Value;
}
Neither of these returns the width. All values are 0.0.
Is there any kind soul out there who knows how to do this.
Many thanks in advance for any assistance offered
Iain