0

i have a gridview in asp.net/vb and it is bound to a list - so there's no standard sorting available.

I've found this jQuery plugin for sorting tables: http://tablesorter.com/

The plugin requires <thead> and <tbody>.

The problem is, that my gridview only renders the <tbody>.

I've already tried

    DataList.UseAccessibleHeader = True
    DataList.HeaderRow.TableSection = TableRowSection.TableHeader

but this changes nothing.

My gridview markup:

<asp:GridView runat="server" CssClass="grid" ID="DataList" AutoGenerateColumns="False" AllowSorting="True" ClientIDMode ="Static">
 <Columns>
   <asp:BoundField HeaderText="SomeHeaderText" DataField="SomeDataField" />  
   <asp:BoundField HeaderText="SomeHeaderText" DataField="SomeDataField" DataFormatString="{0:dd.MM.yyyy}" />
   <asp:BoundField HeaderText="SomeHeaderText" DataField="SomeDataField" DataFormatString="{0:dd.MM.yyyy}" />                                         
   <asp:TemplateField>
     <HeaderTemplate>
       <asp:Panel runat="server" ID="Panel1" HorizontalAlign="Center">
       <asp:Label Text="xxx" runat="server" ID="xxx" />
       </asp:Panel>
     </HeaderTemplate>
     <ItemTemplate>
       <asp:Panel runat="server" ID="Panel2" HorizontalAlign="Center">
       <asp:Image ID="Image1" ImageUrl="./myImage.png" runat="server" Height="20px" />
     </asp:Panel>
    </ItemTemplate>
  </asp:TemplateField>
 </Columns>
</asp:GridView>

What can i do?

1
  • "it is bound to a list - so there's no standard sorting available." you can do sorting on gridview, for that nly MS Paid Lacs of $$ to employee to invent :P Commented Jan 31, 2012 at 10:32

1 Answer 1

1

If you are not going to use the paging feature of the gridview control so i suggest that you move to the "Repeater" as it will give you the power to format the table header section and footer and it will give you the power of rendering the table exactly as you want it to be rendered.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.