DataGrid Not Sorting

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default DataGrid Not Sorting

    My web datagrid isn't sorting at all. I have it wired up to a handler, and I
    know the handler is working (being called), but no sorting. The page just
    posts back with the same data. I hhave verified that the SortExpression
    values are the column names. I used the VS IDE to create a datasource ( a
    DataSet), defined a table and columns, then used the datagrid Propery Builder
    to tie eveything together. The table gets populated with data correctly, I
    just can't get it to sort.

    Any help would be greatly appreciated.
    Michael Caruso Guest

  2. Similar Questions and Discussions

    1. Datagrid sorting
      I have read most messages in regard with this topic, and have tried every measure suggested. I'm still haveing problem to get it to work....
    2. Sorting in the DataGrid
      It's like this: a column in a DataGrid(u know, the component) receives several numbers from an XML,one for each cell, numbers from 0 to 11. Each nr...
    3. sorting a datagrid
      In asp.net I have created a datagrid which it data source is determined at runtime. How can add the auto sort functionality to this datagrid? In...
    4. Sorting in a DataGrid with no headings
      I have got a scrollable datagrid within a Div tag and a fixed header created using an HTML table. I would like to be able to sort the datagrid by...
    5. sorting and datagrid and underline
      how to eliminate underline from sorting headers on a datagrid. I modified <A> in the style sheet. Is there any other way to accomplish this in...
  3. #2

    Default Re: DataGrid Not Sorting

    If you're using a DataGrid then you have to do the sorting yourself in the
    Sort event and rebind the DataGrid. It doesn't sort by itself, unfortunately.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]
    > My web datagrid isn't sorting at all. I have it wired up to a
    > handler, and I know the handler is working (being called), but no
    > sorting. The page just posts back with the same data. I hhave
    > verified that the SortExpression values are the column names. I used
    > the VS IDE to create a datasource ( a DataSet), defined a table and
    > columns, then used the datagrid Propery Builder to tie eveything
    > together. The table gets populated with data correctly, I just can't
    > get it to sort.
    >
    > Any help would be greatly appreciated.
    >

    Brock Allen Guest

  4. #3

    Default Re: DataGrid Not Sorting

    Yep, I'm doing that. The OnSortCommand handler retrieves a dataset from a
    session variable (created when the page loaded), creates a dataview, then
    sorts on the SortExpression from the column clicked, assigns the DataSource
    and then rebinds the grid. Only it doesn't work. It acts like DataView.Sort
    doesn't work. I tried setting the intial sort expression to a different
    column when the page loads, that doesn't work either.

    "Brock Allen" wrote:
    > If you're using a DataGrid then you have to do the sorting yourself in the
    > Sort event and rebind the DataGrid. It doesn't sort by itself, unfortunately.
    >
    > -Brock
    > DevelopMentor
    > [url]http://staff.develop.com/ballen[/url]
    >
    > > My web datagrid isn't sorting at all. I have it wired up to a
    > > handler, and I know the handler is working (being called), but no
    > > sorting. The page just posts back with the same data. I hhave
    > > verified that the SortExpression values are the column names. I used
    > > the VS IDE to create a datasource ( a DataSet), defined a table and
    > > columns, then used the datagrid Propery Builder to tie eveything
    > > together. The table gets populated with data correctly, I just can't
    > > get it to sort.
    > >
    > > Any help would be greatly appreciated.
    > >
    >
    >
    >
    Michael Caruso Guest

  5. #4

    Default Re: DataGrid Not Sorting

    Hmm, not sure then. Sounds like you're doing all the right things. I'd suggest
    making a new project with one page with the one grid and try to see if you
    can make it work outside of everything else -- more of a sanity check. If
    you can get that working then it's not the code you have for the grid, it's
    likley code elsewhere in the page that's thwarting the sort.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]
    > Yep, I'm doing that. The OnSortCommand handler retrieves a dataset
    > from a session variable (created when the page loaded), creates a
    > dataview, then sorts on the SortExpression from the column clicked,
    > assigns the DataSource and then rebinds the grid. Only it doesn't
    > work. It acts like DataView.Sort doesn't work. I tried setting the
    > intial sort expression to a different column when the page loads, that
    > doesn't work either.
    >
    > "Brock Allen" wrote:
    >
    >> If you're using a DataGrid then you have to do the sorting yourself
    >> in the Sort event and rebind the DataGrid. It doesn't sort by itself,
    >> unfortunately.
    >>
    >> -Brock
    >> DevelopMentor
    >> [url]http://staff.develop.com/ballen[/url]
    >>> My web datagrid isn't sorting at all. I have it wired up to a
    >>> handler, and I know the handler is working (being called), but no
    >>> sorting. The page just posts back with the same data. I hhave
    >>> verified that the SortExpression values are the column names. I
    >>> used the VS IDE to create a datasource ( a DataSet), defined a table
    >>> and columns, then used the datagrid Propery Builder to tie eveything
    >>> together. The table gets populated with data correctly, I just
    >>> can't get it to sort.
    >>>
    >>> Any help would be greatly appreciated.
    >>>

    Brock Allen Guest

  6. #5

    Default Re: DataGrid Not Sorting

    I'd considered doing that, but what I do if it does work? What kinds of
    things would prevent the sort from working? I've never tried using the sort
    feature on a datagrid before so this is new territory. I've used dataviews
    before, and implemented sorting, but I've never used the datagrid component
    before like this. Could there be something in the way the DataSource is
    defined in the page that affects the sorting?



    "Brock Allen" wrote:
    > Hmm, not sure then. Sounds like you're doing all the right things. I'd suggest
    > making a new project with one page with the one grid and try to see if you
    > can make it work outside of everything else -- more of a sanity check. If
    > you can get that working then it's not the code you have for the grid, it's
    > likley code elsewhere in the page that's thwarting the sort.
    >
    > -Brock
    > DevelopMentor
    > [url]http://staff.develop.com/ballen[/url]
    >
    > > Yep, I'm doing that. The OnSortCommand handler retrieves a dataset
    > > from a session variable (created when the page loaded), creates a
    > > dataview, then sorts on the SortExpression from the column clicked,
    > > assigns the DataSource and then rebinds the grid. Only it doesn't
    > > work. It acts like DataView.Sort doesn't work. I tried setting the
    > > intial sort expression to a different column when the page loads, that
    > > doesn't work either.
    > >
    > > "Brock Allen" wrote:
    > >
    > >> If you're using a DataGrid then you have to do the sorting yourself
    > >> in the Sort event and rebind the DataGrid. It doesn't sort by itself,
    > >> unfortunately.
    > >>
    > >> -Brock
    > >> DevelopMentor
    > >> [url]http://staff.develop.com/ballen[/url]
    > >>> My web datagrid isn't sorting at all. I have it wired up to a
    > >>> handler, and I know the handler is working (being called), but no
    > >>> sorting. The page just posts back with the same data. I hhave
    > >>> verified that the SortExpression values are the column names. I
    > >>> used the VS IDE to create a datasource ( a DataSet), defined a table
    > >>> and columns, then used the datagrid Propery Builder to tie eveything
    > >>> together. The table gets populated with data correctly, I just
    > >>> can't get it to sort.
    > >>>
    > >>> Any help would be greatly appreciated.
    > >>>
    >
    >
    >
    Michael Caruso Guest

  7. #6

    Default Re: DataGrid Not Sorting

    Well, try it in the standalong page and if you can't get that to work send
    me an email and I can give you a working sample.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]
    > I'd considered doing that, but what I do if it does work? What kinds
    > of things would prevent the sort from working? I've never tried using
    > the sort feature on a datagrid before so this is new territory. I've
    > used dataviews before, and implemented sorting, but I've never used
    > the datagrid component before like this. Could there be something in
    > the way the DataSource is defined in the page that affects the
    > sorting?
    >
    > "Brock Allen" wrote:
    >
    >> Hmm, not sure then. Sounds like you're doing all the right things.
    >> I'd suggest making a new project with one page with the one grid and
    >> try to see if you can make it work outside of everything else -- more
    >> of a sanity check. If you can get that working then it's not the code
    >> you have for the grid, it's likley code elsewhere in the page that's
    >> thwarting the sort.
    >>
    >> -Brock
    >> DevelopMentor
    >> [url]http://staff.develop.com/ballen[/url]
    >>> Yep, I'm doing that. The OnSortCommand handler retrieves a dataset
    >>> from a session variable (created when the page loaded), creates a
    >>> dataview, then sorts on the SortExpression from the column clicked,
    >>> assigns the DataSource and then rebinds the grid. Only it doesn't
    >>> work. It acts like DataView.Sort doesn't work. I tried setting the
    >>> intial sort expression to a different column when the page loads,
    >>> that doesn't work either.
    >>>
    >>> "Brock Allen" wrote:
    >>>
    >>>> If you're using a DataGrid then you have to do the sorting yourself
    >>>> in the Sort event and rebind the DataGrid. It doesn't sort by
    >>>> itself, unfortunately.
    >>>>
    >>>> -Brock
    >>>> DevelopMentor
    >>>> [url]http://staff.develop.com/ballen[/url]
    >>>>> My web datagrid isn't sorting at all. I have it wired up to a
    >>>>> handler, and I know the handler is working (being called), but no
    >>>>> sorting. The page just posts back with the same data. I hhave
    >>>>> verified that the SortExpression values are the column names. I
    >>>>> used the VS IDE to create a datasource ( a DataSet), defined a
    >>>>> table and columns, then used the datagrid Propery Builder to tie
    >>>>> eveything together. The table gets populated with data
    >>>>> correctly, I just can't get it to sort.
    >>>>>
    >>>>> Any help would be greatly appreciated.
    >>>>>

    Brock Allen Guest

  8. #7

    Default Re: DataGrid Not Sorting

    Well, I finally got the Sort to work. I built a test page in my project
    using a sample I found in MSDN. That worked, so I compared the two and the
    only difference was my problem page was using a DataSet stored in a session
    variable and the example was using a DataTable. I changed my code around to
    use a DataTable instead and, voila! It sorted.

    Now my only question is, how do I get the column links to use my default
    style for navigation? I set the Class value (in the HeaderStyle property) to
    use the style in my Style Sheet but it appears to be ignoring it. I just get
    the default browser styles for <a> tags.

    Thx,

    Michael

    "Brock Allen" wrote:
    > Well, try it in the standalong page and if you can't get that to work send
    > me an email and I can give you a working sample.
    >
    > -Brock
    > DevelopMentor
    > [url]http://staff.develop.com/ballen[/url]
    >
    > > I'd considered doing that, but what I do if it does work? What kinds
    > > of things would prevent the sort from working? I've never tried using
    > > the sort feature on a datagrid before so this is new territory. I've
    > > used dataviews before, and implemented sorting, but I've never used
    > > the datagrid component before like this. Could there be something in
    > > the way the DataSource is defined in the page that affects the
    > > sorting?
    > >
    > > "Brock Allen" wrote:
    > >
    > >> Hmm, not sure then. Sounds like you're doing all the right things.
    > >> I'd suggest making a new project with one page with the one grid and
    > >> try to see if you can make it work outside of everything else -- more
    > >> of a sanity check. If you can get that working then it's not the code
    > >> you have for the grid, it's likley code elsewhere in the page that's
    > >> thwarting the sort.
    > >>
    > >> -Brock
    > >> DevelopMentor
    > >> [url]http://staff.develop.com/ballen[/url]
    > >>> Yep, I'm doing that. The OnSortCommand handler retrieves a dataset
    > >>> from a session variable (created when the page loaded), creates a
    > >>> dataview, then sorts on the SortExpression from the column clicked,
    > >>> assigns the DataSource and then rebinds the grid. Only it doesn't
    > >>> work. It acts like DataView.Sort doesn't work. I tried setting the
    > >>> intial sort expression to a different column when the page loads,
    > >>> that doesn't work either.
    > >>>
    > >>> "Brock Allen" wrote:
    > >>>
    > >>>> If you're using a DataGrid then you have to do the sorting yourself
    > >>>> in the Sort event and rebind the DataGrid. It doesn't sort by
    > >>>> itself, unfortunately.
    > >>>>
    > >>>> -Brock
    > >>>> DevelopMentor
    > >>>> [url]http://staff.develop.com/ballen[/url]
    > >>>>> My web datagrid isn't sorting at all. I have it wired up to a
    > >>>>> handler, and I know the handler is working (being called), but no
    > >>>>> sorting. The page just posts back with the same data. I hhave
    > >>>>> verified that the SortExpression values are the column names. I
    > >>>>> used the VS IDE to create a datasource ( a DataSet), defined a
    > >>>>> table and columns, then used the datagrid Propery Builder to tie
    > >>>>> eveything together. The table gets populated with data
    > >>>>> correctly, I just can't get it to sort.
    > >>>>>
    > >>>>> Any help would be greatly appreciated.
    > >>>>>
    >
    >
    >
    Michael Caruso Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139