sort a query task into datagrid

784
4
08-13-2010 02:29 PM
DerikWoo
New Contributor
Hello,

I was wondering if it would be possible to sort the results of a query task into a datagrid?

Thanks

Derik
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
If you plan to use a map with FeatureLayer, you can use the FeatureDataGrid. It already has sorting built-in. In this sample, you can update the FeatureLayer's Where property to define your query task.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid

Otherwise, you can follow this sample as guide for performing query task and assigning results to a datagrid:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap and this codeproject for sorting/grouping/filtering in datagrid:http://www.codeproject.com/Articles/83906/Silverlight-4-Datagrid-Sorting-Grouping-Filtering-.aspx
0 Kudos
DerikWoo
New Contributor
Hi Jennifer,

Thanks for the links.  I think that should do the trick.

Derik

If you plan to use a map with FeatureLayer, you can use the FeatureDataGrid. It already has sorting built-in. In this sample, you can update the FeatureLayer's Where property to define your query task.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid

Otherwise, you can follow this sample as guide for performing query task and assigning results to a datagrid:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap and this codeproject for sorting/grouping/filtering in datagrid:http://www.codeproject.com/Articles/83906/Silverlight-4-Datagrid-Sorting-Grouping-Filtering-.aspx
0 Kudos
LucasCulbertson
New Contributor
Jennifer,

What if I want to be able to dynamically sort the featuredatagrid in the code-behind?  Is there a way to access a sorting method within the datagrid based on the name and/or index of the field that I want sorted?
0 Kudos
LewLadd
New Contributor III
Hi Lucas,
    I asked a similar question in the thread titled:

"Initialize FeatureDataGrid with a sorted column"

   Have you worked out a solution to programmatically sorting a FeatureDataGrid?
Thanks,
Lew.
0 Kudos