Yes, your intuition is correct. The sorting event is not a place to
call the Sort method because it is raised when the Sort method has
been called, but has not been executed.

The sorting EventHandler can be used to modify how the sort occurs -
the direction or the sort expression, for example. I think you got the
"sorting event was not handled" message because you might have added
the "onsorting" attribute to your GridView.

On Nov 18, 7:19 pm, "Charles.Wang" <[EMAIL PROTECTED]> wrote:
> I added an Open buttonField to GridView to open a second GridView then
> checked AllowSorting on the second. I got error saying the Sorting
> event was not handled. I added my own Sorting event handler with the
> following line:
>
>          GridView2.Sort( e.SortExpression, e.SortDirction );
>
> Then I got an exception saying there was an infinite loop. Tracing the
> code with debug I did find that this line was executed repeatedly
> without ending. I replaced "e" expression with some constant values,
> resulting in the same error. Can't think of other alternatives.
>
> When searching MSDN I found that Sort() in GridView has sample code
> used by a button. So maybe Sort() can not be used in the Sorting
> handler? Please help.
>
> My second GridView uses the data selected from the first GridView.
>
> In the first GridView the data source is a SQL Server table. The
> sorting is fine without needing any extra code.
>
> Thanks!
>
> Charles
> 11/18

Reply via email to