Hello all,

I've searched here and in google for my problem. But what I didn´t found what i was looking for (lol looks like the U2 song)...

Anyway, I have a gridview with paging implemented.

And now what i want is to add the sorting feature to it.

So far I have:

Code:
<asp:GridView ID="GridView1" allowpaging="True" allowsorting="True" runat="server"
                CssClass="DataWebControlStyle" CellPadding="4" Font-Names="Verdana" Font-Size="X-Small" 
                AutoGenerateColumns="False" ForeColor="#333333" GridLines="None" 
Width="496px" CellSpacing="2" 
                PageSize="15" datakeynames="NID" 
emptydatatext="No data available."   
                onpageindexchanging="GridView1_PageIndexChanging" OnSorting="GridView1_Sorting">
                
                <HeaderStyle CssClass="HeaderStyle" BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle CssClass="AlternatingRowStyle" BackColor="White" ForeColor="#284775" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <EditRowStyle BackColor="#999999" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                
                <Columns>
                    <asp:BoundField DataField="Product" HeaderText="Product"><ControlStyle Width="40px" />
                        <ItemStyle Width="200px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="name" >
                        <ItemStyle Width="200px" />
                    </asp:BoundField>
                </Columns>
                    </asp:GridView>
                <asp:Label ID="Message" runat="server" ForeColor="Red"></asp:Label>

And in the aspx.vb page I have:

Code:
 
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)

        GridView1.Sort(e.SortExpression, SortDirection.Ascending)
        GridView1.DataBind()
    End Sub
but this isn't working, when I click in collumn "Nome" the error is:

An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll

Some help?

regards,