[Asp.net] Three solutions for rendering thead in GridView

Source: Internet
Author: User

Introduction

When the jquery plug-in jquery. tablesorter is used in the project to sort the table, the code from the gridview render is uncomfortable. The default HTML structure requires the <thead/> label. As a result, tablesort cannot be used.

 

Is the gridview render <thead/> label?

By default (vs2008), the <thead/> <tbody/> <tfoot/> label is not displayed.

 

Solution

Solution 1:Modify the jquery. tablesorter plug-in so that it can be used without the thead tag. (Not implemented)

 

SolutionII:Find ways to make the gridview render output <thead/> and other labels to cater to the default structure of jquery. tablesorter.

 

GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;

 

After gridview1 is bound to the data source, add the preceding code to render the <thead/> label.

 

SolutionIII:Use jquey to wrap the <thead/> label in the first line of the table, and insert it to the <tbody/> label.

          $(function() {             $("#GriView1 tr:first").wrap("<thead></thead>");             $("#GriView1 thead").insertBefore("#GriView1 tbody");             $("#GriView1").tablesorter();         });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.