GridvIew sorting event handling

Discussion in 'ASP .Net Web Controls' started by Carlos, May 11, 2006.

  1. Carlos

    Carlos Guest

    Hi all,

    I have set allowsorting to true in one of my columns
    of my gridview, and I noticed that it gets underlined in the gridview
    control. I have also defined the
    gridview1_sorting event handler in my code, but I still
    get an exception raised. i.e.:

    The GridView 'GridView1' fired event Sorting which wasn't handled

    Can somebody help?

    Thanks,

    Carlos
    Carlos, May 11, 2006
    #1
    1. Advertising

  2. Carlos

    PeterKellner Guest

    what is your datasource for your gridview? If it's an objectdatasource, you
    need to specify
    SortParameterName="SortData"

    in your objectdatasource declaration.

    Then, you have to have a method that looks something like this:

    [DataObjectMethod(DataObjectMethodType.Select, true)]

    static public List<MembershipUserWrapper> GetMembers(string sortData)

    {

    // All Users, All approvalStatus

    return GetMembers(true, true, null, sortData);

    }

    I've got an examle on my blog of doing this with the ObjectDataSource if
    that is what you are using.

    http://peterkellner.net/?p=24

    Good Luck,



    -Peter






    "Carlos" <> wrote in message
    news:...
    > Hi all,
    >
    > I have set allowsorting to true in one of my columns
    > of my gridview, and I noticed that it gets underlined in the gridview
    > control. I have also defined the
    > gridview1_sorting event handler in my code, but I still
    > get an exception raised. i.e.:
    >
    > The GridView 'GridView1' fired event Sorting which wasn't handled
    >
    > Can somebody help?
    >
    > Thanks,
    >
    > Carlos
    >
    PeterKellner, May 14, 2006
    #2
    1. Advertising

  3. Carlos

    aspnetguy Guest

    Hi,

    Set the Property EnablePagingSortingCallback as true.

    It will do sorting automatically.

    Regards,
    Thiru

    PeterKellner wrote:
    > what is your datasource for your gridview? If it's an objectdatasource, you
    > need to specify
    > SortParameterName="SortData"
    >
    > in your objectdatasource declaration.
    >
    > Then, you have to have a method that looks something like this:
    >
    > [DataObjectMethod(DataObjectMethodType.Select, true)]
    >
    > static public List<MembershipUserWrapper> GetMembers(string sortData)
    >
    > {
    >
    > // All Users, All approvalStatus
    >
    > return GetMembers(true, true, null, sortData);
    >
    > }
    >
    > I've got an examle on my blog of doing this with the ObjectDataSource if
    > that is what you are using.
    >
    > http://peterkellner.net/?p=24
    >
    > Good Luck,
    >
    >
    >
    > -Peter
    >
    >
    >
    >
    >
    >
    > "Carlos" <> wrote in message
    > news:...
    > > Hi all,
    > >
    > > I have set allowsorting to true in one of my columns
    > > of my gridview, and I noticed that it gets underlined in the gridview
    > > control. I have also defined the
    > > gridview1_sorting event handler in my code, but I still
    > > get an exception raised. i.e.:
    > >
    > > The GridView 'GridView1' fired event Sorting which wasn't handled
    > >
    > > Can somebody help?
    > >
    > > Thanks,
    > >
    > > Carlos
    > >
    aspnetguy, May 15, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arjen
    Replies:
    3
    Views:
    68,949
    JackMcKenzie
    Nov 1, 2007
  2. Stu Lock
    Replies:
    1
    Views:
    1,008
    =?Utf-8?B?UmFnaHVyYW0gUmFpY2hvb3Rp?=
    May 17, 2006
  3. gnewsgroup
    Replies:
    0
    Views:
    1,042
    gnewsgroup
    Dec 13, 2007
  4. Jason
    Replies:
    0
    Views:
    380
    Jason
    Oct 4, 2006
  5. jobs
    Replies:
    2
    Views:
    1,584
Loading...

Share This Page