Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Index from a DataRow in DataGrid

Status
Not open for further replies.

chreinke

Programmer
Mar 12, 2003
2
0
0
DE
Hi,

i have a problem with the DataView/DataGrid.

I have a DataTable with DataRows inside. I create a DataView and use the DataTable as DataSource.
After this I create a DataGrid and use the DataView as DataSource.

Now i want to select a specfic DataRow of the DataTable in the DataGrid with the "CurrentRowIndex" - Property.
But I need the index of the DataRow in the DataGrid to use this property.

My problem is: How can I get the index of the DataRow in the DataGrid?


I tested the "Find" - Method of the DataView.
The method searches only in the current Sort - Columns ("DataView.Sort").
But I must search with the primarykey - columns to find the DataRow.


Knows one how I can do this.
 
Hi,

Not sure if I fully understood your question, but if the problem is that you can't find the data you want because your datagrid doesn't have primary key information, consider using a DataSet object if you're not already. If you are using DataSet, and you still don't have primary key info, then you need to call the FillSchema method before you call the Fill method, and your DataSet will be populated with all metadata including PrimaryKey.
See the article here:

I apologise if I've misunderstood your question.

Phin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top