-
June 23rd, 2003, 12:09 PM
#1
Datagrid
Hey All,
Is there a simple way to get a collection of rows out of the datagrid. I know you can use the isSelected method of the datagrid control, but I want to get the text value out of a certain column of the selected row. Im new to the datagrid control, so any help would be appreciated.
Thanks,
Ryan
-
June 23rd, 2003, 12:22 PM
#2
from MSDN,
private void PrintCellValues(DataGrid myGrid){
int iRow;
int iCol;
DataTable myTable;
// Assumes the DataGrid is bound to a DataTable.
myTable = (DataTable) dataGrid1.DataSource;
for(iRow = 0;iRow < myTable.Rows.Count ;iRow++) {
for(iCol = 0;iCol < myTable.Columns.Count ;iCol++) {
Console.WriteLine(myGrid[iRow, iCol]);
}
}
}
-Paresh
- Software Architect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|