DataView.Sort does NOTHING
-
I'm trying to sort the data in my table, but no matter what I do with the Sort property, the resultant data does not change it's order at all. Does anyone know what I'm missing ? The authors of MSDN apparently missed it too, if there's a step I need to take...
DataSet comparisonDocs = facade.CompareMetadata(objectVids, elementPaths); DataView compSort = new DataView(comparisonDocs.Tables[0]); compSort.Sort="Title, Version/Major DESC, Version/Minor DESC"; comparisonRepeater.DataSource = compSort; comparisonRepeater.DataBind();
Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder -
I'm trying to sort the data in my table, but no matter what I do with the Sort property, the resultant data does not change it's order at all. Does anyone know what I'm missing ? The authors of MSDN apparently missed it too, if there's a step I need to take...
DataSet comparisonDocs = facade.CompareMetadata(objectVids, elementPaths); DataView compSort = new DataView(comparisonDocs.Tables[0]); compSort.Sort="Title, Version/Major DESC, Version/Minor DESC"; comparisonRepeater.DataSource = compSort; comparisonRepeater.DataBind();
Christian I have drunk the cool-aid and found it wan and bitter. - Chris MaunderIs
Version/Major
supposed to be a field name? If so, try[Version/Major]
. If you mean theMajor
field from theVersion
table, use.
instead of/
, although I'm not sure how that'd work in this case since yourDataView
is over a specificDataTable
. IfVersion
is a related table (and aDataRelation
is established between the two), then useChild(_RelationshipName_)._FieldName_
which should work.Microsoft MVP, Visual C# My Articles
-
Is
Version/Major
supposed to be a field name? If so, try[Version/Major]
. If you mean theMajor
field from theVersion
table, use.
instead of/
, although I'm not sure how that'd work in this case since yourDataView
is over a specificDataTable
. IfVersion
is a related table (and aDataRelation
is established between the two), then useChild(_RelationshipName_)._FieldName_
which should work.Microsoft MVP, Visual C# My Articles
Version/Major is indeed a field name. I didn't know that / was reserved in SQL, but I initially sorted by Title only, so I'm not sure that the [] is going to help ( it didn't sort by Title when I just specified 'Title' as the order by before ). Also, when I got the name wrong ( I'm not responsible for the schema ), and just put VersionMajor, it blew up on the basis that the column did not exist, so it presumably can see that Version/Major is a column name the way the code stands. Have you used the sort property before ? It's supposed to work just the way that I'm trying to use it, isn't it ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
I'm trying to sort the data in my table, but no matter what I do with the Sort property, the resultant data does not change it's order at all. Does anyone know what I'm missing ? The authors of MSDN apparently missed it too, if there's a step I need to take...
DataSet comparisonDocs = facade.CompareMetadata(objectVids, elementPaths); DataView compSort = new DataView(comparisonDocs.Tables[0]); compSort.Sort="Title, Version/Major DESC, Version/Minor DESC"; comparisonRepeater.DataSource = compSort; comparisonRepeater.DataBind();
Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maundertry: DataView compSort = comparisonDocs.Tables[0].DefaultView;
-
try: DataView compSort = comparisonDocs.Tables[0].DefaultView;
Thanks, I did that. It turned out the sort was working, but the way the old code ( which I didn't write ) got it's details to render involved an array of objects instead of the data in the table... :wtf::confused: Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
Thanks, I did that. It turned out the sort was working, but the way the old code ( which I didn't write ) got it's details to render involved an array of objects instead of the data in the table... :wtf::confused: Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Glad to see you got it working. I had a reply sitting at work that I couldn't submit because the site wasn't working ("The resource is in use"). :(
Microsoft MVP, Visual C# My Articles
-
I'm trying to sort the data in my table, but no matter what I do with the Sort property, the resultant data does not change it's order at all. Does anyone know what I'm missing ? The authors of MSDN apparently missed it too, if there's a step I need to take...
DataSet comparisonDocs = facade.CompareMetadata(objectVids, elementPaths); DataView compSort = new DataView(comparisonDocs.Tables[0]); compSort.Sort="Title, Version/Major DESC, Version/Minor DESC"; comparisonRepeater.DataSource = compSort; comparisonRepeater.DataBind();
Christian I have drunk the cool-aid and found it wan and bitter. - Chris MaunderWhy don't you try prefixing the field with the table name followed by a period. [EDIT] Just read you got it working, sorry, I should read through everything before posting! :rolleyes: [/EDIT] - Nick Parker
My Blog | My Articles