G
Guest
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).GetEnumerator();
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
{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).GetEnumerator();
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