Default sorting with descending order

Last post 11-25-2008 4:33 AM by sjnaughton. 1 replies.

Sort Posts:

  • Default sorting with descending order

    11-25-2008, 12:11 AM
    • Member
      7 point Member
    • Balyk
    • Member since 04-23-2008, 9:09 AM
    • Russia
    • Posts 31
    I have some table with Date column. I want to have default sorting on my Date column with descending order that rows with last date wil be on the top. I have a LINQ to SQL DataSource. I have attempted to use OrderByParameters, but I can't make descending order on my column. Which the best way to resolve my problem? May be there is some way in Dynamic Data framework not in DataSource. How can I intercept creating Select command to database?
  • Re: Default sorting with descending order

    11-25-2008, 4:33 AM
    Answer
    • Star
      12,082 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,530
    • TrustedFriends-MVPs

    I would say you need to tell the GridView which column to sort on by default I would asume that this will be a custom DD page.

    if (!IsPostBack)
        GridView1.Sort("LastName, FirstName", SortDirection.Ascending);

    In the Page_Load

    Hope this helps Big Smile

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
Page 1 of 1 (2 items)