benjamin54
benjamin54

Reputation: 1300

Sorting a datatable with datatable.DefaultView.Sort

I'm trying to sort a datatable. But it's not working.

arr[0] = "name"; 
arr[1] = "DESC";

myDataSet.Tables["table1"].DefaultView.Sort = arr[0] + " " + arr[1];

Here, myDataSet refers to dataset I'm using for the reportviewer.

Am I missing something? Is there any other way?

Upvotes: 0

Views: 3111

Answers (1)

AMember
AMember

Reputation: 3057

Remmber that you have to use the default view as your new data source for the viewer.

Call your bind method with the defaultView property and then ToTable()

Upvotes: 2

Related Questions