We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can I map Grid cell to row in DataSource?

Thread ID:

Created:

Updated:

Platform:

Replies:

3519 Mar 26,2003 06:47 PM UTC Mar 28,2003 04:57 PM UTC WinForms 5
loading
Tags: GridControl
Curtis Koppang
Asked On March 26, 2003 06:47 PM UTC

Looking for a way to get to the exact row in the DataTable, give the row index in the Grid. I am using the GridDataBoundGrid and am binding to a hierarchical DataSet. Is there a way to do this? Tx, curt

Administrator [Syncfusion]
Replied On March 26, 2003 11:30 PM UTC

Have you tried this.gridDataBoundGrid1.Binder.RowIndexToListManagerPosition to see if that will give you the value you want?

Andy Ullman
Replied On March 27, 2003 03:33 PM UTC

Hey Curt! I'm working on the same issue. According to another post, Binder.RowIndexToListManagerPosition will work until the datagrid ordering changes (through a sort, on new rows added), then the index into Rows doesn't match up anymore. Instead, you should index through Table["table"].DefaultView.Item[Binder.RowIndexToListManagerPosition] I can't test this though - for some reason, the compiler is complaining that Item is not a property of a DataView. The docs clearly state that it is (unless I'm missing something stupid). I'm going to install .net framwork sp2 and see if that fixes it. Andy > Have you tried > > this.gridDataBoundGrid1.Binder.RowIndexToListManagerPosition > > to see if that will give you the value you want?

Andy Ullman
Replied On March 27, 2003 03:58 PM UTC

Now I see my mistake. You access it like this: ds.Tables["table"].DefaultView[Binder.RowIndexToListManagerPosition] Compiles but still not working for me. ANdy

Sean Greer
Replied On March 27, 2003 04:10 PM UTC

Does this not work? int nRowIndex = grid.Binder.CurrentRowIndex; int nListIndex = grid.Binder.RowIndexToListManagerPosition(nRowIndex); DataRowView drv = ds.YourTable.DefaultView[nListIndex];

Andy Ullman
Replied On March 28, 2003 04:57 PM UTC

It was not giving me the correct row in the datatable when the datagrid was sorted. I studied a working example from another post and found one difference with my code - in my code, I set datagrid.datasource equal to the dataset, and datagrid.datamember = "table name". In the working example, datagrid.datasource is set to the datatable (the object). I made that change in my code and now it works. Looks like a bug. I'm using grid ver 1.5.2. Andy

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;