I have a method SelectedRow() that grabs the content of a selected DataGrid row
private System.Data.DataRowView SelectedRow()
{
System.Data.DataRowView row = (System.Data.DataRowView)dgBrokerages.SelectedItems[0];
return row;
}
and would like to know how I can obtain an int containing the number of Columns that row contains.
private int NumColumns()
{
System.Data.DataRowView row = SelectedRow();
return row.Length; // <- Something like that
}
I'm basically looking for if there is a row.Length or row.Size?
Thanks, iato
Try this:
private int NumColumns()
{
System.Data.DataRowView row = SelectedRow();
return row.Row.Table.Columns.Count;
}