Datagrid at sort postback how can i retrivie the sortcommand before binding?

P

Pablo

Hi!
I try to create a custom DataGrid and i need to retrive the
SortExpression that i send when i click on the header of a column.
Ok i know, i can handle the OnSortCommand event.
But i don't want to create an handle function in the code behind.
I want to directly expose a property of the dataGrid with the last
SortExpression requested by user.
I try to do this, but i see that the overrides OnSortCommand function
is fired AFTER the dataBinding ...
i need to know it BEFORE the databind to make the right query and the
right sort of datasouce!

Thanks a lot!
Ps: sorry for my english :p
 
S

Sonu Kapoor

What you can do is the following:

1) Use LinkButtons as the Columns headers.
2) Implement the ItemCommand event on those buttons.
3) Store the sortexpression inside the CommandArgument of each button
4) When the button is clicked retrieve the sortexpression via e.CommandArgument.

That should help to get you going. Let me know if you need more help.

Sonu Kapoor [MVP]
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top