GridvIew sorting event handling

C

Carlos

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
 
P

PeterKellner

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
 
A

aspnetguy

Hi,

Set the Property EnablePagingSortingCallback as true.

It will do sorting automatically.

Regards,
Thiru
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 said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top