J J Jul 14, 2004 #1 Does anyone know how to get the row count for a datagrid? It seems like it should be simple, alas it is not. datagrid1.GetRowCount?
Does anyone know how to get the row count for a datagrid? It seems like it should be simple, alas it is not. datagrid1.GetRowCount?
B Bob Grommes Jul 14, 2004 #2 A DataGrid is a display widget, not a container for records. What would RowCount be anyway -- displayed rows, or total rows? I think you will have to examine this at the level of the underlying data table or binding manager or whatever. --Bob
A DataGrid is a display widget, not a container for records. What would RowCount be anyway -- displayed rows, or total rows? I think you will have to examine this at the level of the underlying data table or binding manager or whatever. --Bob
J Jeff Louie Jul 14, 2004 #3 J... Never tried it but Items returns a collection and collection has a count http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/ html/frlrfsystemwebuiwebcontrolsdatagriditemcollectionclasscounttopic.as p Regards, Jeff Does anyone know how to get the row count for a datagrid? It seems Click to expand... like it should be simple, alas it is not.<
J... Never tried it but Items returns a collection and collection has a count http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/ html/frlrfsystemwebuiwebcontrolsdatagriditemcollectionclasscounttopic.as p Regards, Jeff Does anyone know how to get the row count for a datagrid? It seems Click to expand... like it should be simple, alas it is not.<
K Ken Arway Jul 14, 2004 #4 J said: Does anyone know how to get the row count for a datagrid? It seems like it should be simple, alas it is not. datagrid1.GetRowCount? Click to expand... You use the row count of the returned records in the appropriate table of your dataset: int iCnt; iCnt = this.BindingContext[datasetname, "tablename"].Count;
J said: Does anyone know how to get the row count for a datagrid? It seems like it should be simple, alas it is not. datagrid1.GetRowCount? Click to expand... You use the row count of the returned records in the appropriate table of your dataset: int iCnt; iCnt = this.BindingContext[datasetname, "tablename"].Count;
S Shakir Hussain Jul 14, 2004 #5 Try this int rowCount = ((DataTable)this.dataGrid1.DataSource).Rows.Count;