Thank you, Cerebrus. Yes the error occurred after I checked "Allow
Sorting" in the property window. Now I have unchecked this box and the
column heading has been black instaed of blue. The error disappeared
but there is no sorting now. Please advise.

I did not create the onsorting (empty) handler. If I do and without
adding Sort(), there is no error but clicking heading also has no
effect. I doubt that Microsoft VS2008 has some fault here.

Charles
11/19

On Nov 19, 11:36 am, Cerebrus <[EMAIL PROTECTED]> wrote:
> 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- Hide quoted text -
>
> - Show quoted text -

Reply via email to