gettig the DataRow of a selected item in a Datagrid

C

chris

Hallo everybody,

I have a DataGrid bound to a DataTable(witha key column) in some DataSet,
now i want to get the DataRow, to which the selected row in the DataGrid is
bound. How can I do it. Have I to use Find method or something else.

thanks in advance
 
M

Miha Markic

Hi Chris,

Try using BindinManagerBase:

BindingManagerBase bmGrid;
bmGrid = BindingContext[myDataSet, "TABLENAME"];

bmGrid.Position should give you row index in datasource.
 
C

chris

Thanks it worked perfectly

Miha Markic said:
Hi Chris,

Try using BindinManagerBase:

BindingManagerBase bmGrid;
bmGrid = BindingContext[myDataSet, "TABLENAME"];

bmGrid.Position should give you row index in datasource.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

chris said:
Hallo everybody,

I have a DataGrid bound to a DataTable(witha key column) in some DataSet,
now i want to get the DataRow, to which the selected row in the DataGrid is
bound. How can I do it. Have I to use Find method or something else.

thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top