469,964 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

How to get RowIndex in dataview based on primary key value

Hi All,

I am using .net framework 1.1 and c#. I have one problem regarding dataview.

I have one dataview to which sorting may be applied or may not be applied. I have one UI component where I am displaying the dataview. All rows in dataview are displayed in the sequence as they appear in dataview. i.e. there is direct mapping between dataview rows and UI rows.

I have subscribed ColumnChanged event of the datatable on which dataview is created. In column changed event I want to update the single column value on UI that has been changed. In Columnchanged event I want to find out the corrosponding row in UI ie. in dataview (dataview and UI rows are directly mapped.)

There are Dataview.find & dataview.findrows methods. but these method need Sort property to be set, it work on columns on which sorting is applied. I do not want this as in my case it is not necessary to be have some sorting on dataview.

currently i am doing looping through dataview and comparing the column values to find out the perticular index of row in dataview and then update the UI.

I have tried dataview ListChanged event also. But in listevent we can get whether itemadded, itemchanged, itemdeleted, itemmoved and the newIndex and OldIndex. but in itemchanged type we can not get any idea about which column is changed. Hence i am using Columnchanged event of underlying datatable to get know which column is changed.

But it is time consuming. If dataview is with 500, 600 rows, then this comparision takes too much time. I want some efficient method to find out the rowindex in dataview depending upon some column value (may be primary key)

Any help regaring this will be appriciated.

Pravin
Dec 18 '07 #1
0 1950

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by jwedel_stolo | last post: by
11 posts views Thread by Tim Frawley | last post: by
4 posts views Thread by Aaron Smith | last post: by
reply views Thread by Nathan Franklin | last post: by
4 posts views Thread by m - team1 via DotNetMonster.com | last post: by
2 posts views Thread by =?Utf-8?B?UmljaA==?= | last post: by
3 posts views Thread by =?Utf-8?B?cm9kY2hhcg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.