Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
WebDataGrid Default Sort Direction
posted

Hello

I have a WebDataGrid bound to a DataView, with sorting enabled. About half of the columns contain strings and the other half contain numbers. Is there a way that would allow that numeric columns to sort in descending order by default (instead of sorting ascending and then descending), while keeping the string column's sort to be ascending?

Parents
  • 33839
    Verified Answer
    posted

    Hi,

    The column settings unfortunately won't do this for you.  But you can perform it relatively easily.  You will want to handle the column sorting client event.  Off of the event args, you can get the column and the sort direction about to be applied.  You can check if the column is already sorted from the sorting behavior.  If it is not, then check the column type and set the sort direction to what you want- descending for numbers and ascending for text.  Let me know if you need help with the code.

    regards,
    David Young

Reply Children