Hi Guys,
I have a DataView that was already populated with data (Verified this to be true).
I then set the DataSource of my GridView to that DataView and called the .DataBind() Function.
Right after binding, I checked the column count of my GridView (grid.Columns.Count) and it shows 0. But it is showing the right output with 15 columns.
Also, accessing a column using its index will throw an exception.
How can I access the column then?
Thanks!
EDIT -- Additional Info:
I actually need to add a "glyph" (UP/DOWN arrow) in the column header to show what column are being sorted and its direction. The code below is what I am using. Problem is, the Columns.Count is always zero.
for (int i = 0; i < dgData.Columns.Count; i++)
{
string colExpr = dgData.Columns[i].SortExpression;
if (colExpr != "" && colExpr == dgData.SortExpression)
item.Cells[i].Controls.Add(glyph);
}