I use a DataView object as the datasource for an ASP.NET DataGrid. I
am seting the DataView.Sort member with a column name and a direction,
eg:

dvEmp.Sort = "emp_name DESC";

This works fine, but when I post back to the page and look at the
dvEmp.Sort value, it only contains "emp_name", and appears to have
discarded the " DESC" specifier. Despite this, the dataview is
actually sorted correctly in descending order.

What gives?

John H.

Re: DataView.Sort loses ASC/DESC value by William

William
Tue Apr 27 13:16:01 CDT 2004

I'd need to look at your code to be 100 % sure, but I bet it's losing it's
state (resetting itself) on the post back. Store the grid in session state
and bind to it so you can maintain it's state through post backs.
"Kubuli John" <john@haasbeek.com> wrote in message
news:6e87733c.0404270948.6b577c07@posting.google.com...
> I use a DataView object as the datasource for an ASP.NET DataGrid. I
> am seting the DataView.Sort member with a column name and a direction,
> eg:
>
> dvEmp.Sort = "emp_name DESC";
>
> This works fine, but when I post back to the page and look at the
> dvEmp.Sort value, it only contains "emp_name", and appears to have
> discarded the " DESC" specifier. Despite this, the dataview is
> actually sorted correctly in descending order.
>
> What gives?
>
> John H.