DataView.Sort loses ASC/DESC value

  • Thread starter Thread starter Kubuli John
  • Start date Start date
K

Kubuli John

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.
 
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.
 
Back
Top