Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datagrid: Retreiving a value from a column
Message
 
To
07/10/2002 06:44:58
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00708298
Message ID:
00708368
Views:
8
This message has been marked as a message which has helped to the initial question of the thread.
You can try CurrentCell.RowNumber. Here is an example.
private void PrintCell(object sender, MouseEventArgs e)
{
   DataGrid thisGrid = (DataGrid) sender;
   DataGridCell myDataGridCell = thisGrid.CurrentCell;
   BindingManagerBase bm = BindingContext[thisGrid.DataSource, thisGrid.DataMember];
   DataRowView drv = (DataRowView) bm.Current;
   Console.WriteLine(drv [myDataGridCell.ColumnNumber]);
   Console.WriteLine(myDataGridCell.RowNumber);
}
>HI,
>
>I want to be able to choose from values of a pick list (datagrid) and get the ID selected. I then use this ID to query other tables.
>
>I use this code to get a value from a tables's column:
>
>DataRowCollection drcol = oDs.Tables["MyTable"].Rows;
>DataRow dr = drcol[0];
>string sID= dr["MyColumn"].ToString();
>
>My problem is that the row I want to get will not be the first one of the pick list. How can I rettrive a row # from the datagrid? I tried the CurrentRowIndex property but if the user sort the grid using the column header, the row index returned will not match the one in the source table.
>
>Thank you for your help,
>Christian
- Jayesh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform