473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DataView data accessor aware of sorting used

Is it possible somehow to retreive {data Key Value} based on clicked
{datagrid item index} ? Now i'm trying to do this in the following way, but
with no effect.
Now, Instead of getting value according to specified sort key i get wrong data
HandleInnerDGRControlItemClick(Object sender, DataGridCommandEventArgs args)
{

int clickedIndex = args.Item.ItemIndex;

....

int documentID = (int)(((DataView)((DataGrid)sender).DataSource).
Table.Rows[selectedIndex][MAIN_DATAGRID_DATAKEY]);

//documentID DOES NOT POINT VALID DOCUMENT, but something according to other
sort key

}

However, if I loop through the DataRowView Collection, I CAN find the
document ID
IEnumerator iEnum = ((DataView)((DataGrid)sender).DataSource).GetEnume rator();
int index = 0;
while(iEnum.MoveNext())
{
//Object nextObj =iEnum.Current;
DataRowView dr = (DataRowView)iEnum.Current;

if(index == selectedIndex)
{
documentID = (int)dr[MAIN_DATAGRID_DATAKEY];
//WE HAVE FOUND IT !!
break;
}
index++;
}

Is it possible that I can retreive the key of the document (documentID)
WITHOUT
the loop ?

I think that I had achieved this some time ago by using some property
exposed by DataView, but I cannot find it now.
The only property exposed by the DataView that takes into account sortKey is
the enumerator that I use to LOOP through the rows (actually DataRowView-s).
I would like to get value of {some column} of {some specified row} in the
following manner:

Object value = someData.DataView.PropertyAwareOfSorting[rowID][columnID];

is it possible ?

Thank You
Michał Januszczyk

Nov 18 '05 #1
0 1146

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
9
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a...
10
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this...
4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
1
by: TaeHo Yoo | last post by:
Hi all, After sorting and grouping data using a dataview, then how to transfer the changed datatable in the dataview to a datatable in C#? Cheers
2
by: Jason Huang | last post by:
Hi, In the ASP.Net, what's the difference between DataSet and DataView? I what situation will I choose to use the DataSet or DataView? Thanks for help. Jason
0
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
6
by: Nick | last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to sort with IList returned, it say it only suports DataView, DataTable and DataSet, not IEnumerable. I don't know how to...
10
by: babis | last post by:
I work with .NET2003 C# windows form application, i add a datagrid in my form like this: dataGridProduct.DataSource = dataViewProduct; I also make the allowSort property of the datagrid...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.