Prasanna Prasanna - 2 months ago 28 Question

How to get table column count programmatically

I am using table where I have to get the number of columns, I wonder there is no any property for table like grid has "Gridview.columns.count".
Please suggest.


I think there is .count property for table class but it support over .net framework 3.0 and above see below snippet

//add table first
Table tbl = new Table();
int columnsToAdd = 4;
for (int x = 0; x < columnsToAdd; x++)
tbl.Columns.Add(new TableColumn());
//then get table count
int columns = tbl.Columns.Count;

hope it helps