Can't sort DataGrid

Discussion in 'ASP .Net Web Controls' started by Joe, Oct 7, 2005.

  1. Joe

    Joe Guest

    ello,

    I have a datagrid in an nested html table (one table inside of another
    table) and have set the allowsSorting property to true. I've created in the
    code-behind a method (Sub - I'm using VB.NET) that handles the SortCommand
    event of the data grid. I've included the declaration of the Sub below.
    EnableViewState is set to false; we reload the DataSource each time the page
    posts.

    Would anyone know why this DataGrid doesn't sort? The web server isn't
    executing the SortCommand event handler.

    If tehre is any other information that I can offer, please elt me know.
    This really has me stumped.

    Sub Declaration:*********************************
    Private Sub SortDataGridColumns(ByVal sender As System.Object, ByVal e As
    System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
    dgForms.SortCommand

    PopulateClaimFormsDataGrid(e.SortExpression,
    SwapSortDirection(e.SortExpression))
    End Sub
    *********************************************

    Data Grid HTML**********************************
    <asp:datagrid id="dgForms" runat="server" CssClass="Interior"
    AllowSorting="True" AutoGenerateColumns="False">
    <AlternatingItemStyle
    BackColor="GhostWhite"></AlternatingItemStyle> <ItemStyle
    BackColor="Gainsboro"></ItemStyle>
    <Columns>
    <asp:HyperLinkColumn Target="_self"
    DataNavigateUrlField="Form_Path_File_NM" DataTextField="Form_Number"
    SortExpression="Form_Number" HeaderText="NUMBER">
    <HeaderStyle Width="10%" CssClass="TableHeader"></HeaderStyle>
    <ItemStyle CssClass="TableData"></ItemStyle>
    </asp:HyperLinkColumn>
    <asp:BoundColumn DataField="Form_Name" SortExpression="Form_Name"
    HeaderText="NAME">
    <HeaderStyle Width="50%" CssClass="TableHeader"></HeaderStyle>
    <ItemStyle CssClass="TableData"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="Description"
    SortExpression="Description" HeaderText="CATEGORY">
    <HeaderStyle Width="25%" CssClass="TableHeader"></HeaderStyle>
    <ItemStyle CssClass="TableData"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="Form_State_CD"
    SortExpression="Form_State_CD" HeaderText="STATE">
    <HeaderStyle Width="15%" CssClass="TableHeader"></HeaderStyle>
    <ItemStyle CssClass="TableData"></ItemStyle>
    </asp:BoundColumn>
    </Columns>
    </asp:datagrid>
    *********************************************

    TIA,

    --
    Joe

    VBA Automation/VB/C++/Web and DB development
    Joe, Oct 7, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eugene
    Replies:
    0
    Views:
    468
    Eugene
    Sep 28, 2004
  2. nobody
    Replies:
    0
    Views:
    521
    nobody
    Jun 1, 2004
  3. JerryJ
    Replies:
    11
    Views:
    1,376
    Dave Moore
    Apr 28, 2004
  4. Navin
    Replies:
    1
    Views:
    659
    Ken Schaefer
    Sep 9, 2003
  5. colin_lyse
    Replies:
    1
    Views:
    136
    Tore Aursand
    Feb 3, 2005
Loading...

Share This Page