This works well for Gridview
References include in the page
<script src="/_layouts/XX.XX.UI/js/jquery.dataTables.min.js" type="text/javascript"></script>
<link href="/_layouts/XX.XX.UI/css/datatable_css.css" rel="stylesheet" type="text/css" />
Script include in the page
<script type="text/javascript">
function pageLoad() {
$('#<%=gvNews.ClientID%>').dataTable({
"bSort": false,
"bPaginate": true,
"sPaginationType": "full_numbers"
});
}
</script>
Gridview prerender needs to be include
protected void gvNews_PreRender(object sender, EventArgs e)
{
try
{
if (gvNews.Rows.Count > 0)
{
//This replaces <td> with <th> and adds the scope attribute
gvNews.UseAccessibleHeader = true;
//This will add the <thead> and <tbody> elements
gvNews.HeaderRow.TableSection = TableRowSection.TableHeader;
//This adds the <tfoot> element.
//Remove if you don't have a footer row
gvNews.FooterRow.TableSection = TableRowSection.TableFooter;
}
}
catch (Exception ex)
{
Logger.LogEntry("News webpart, gvNews_PreRender method : " + ex.Message);
}
}
Reference:
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/default.html
References include in the page
<script src="/_layouts/XX.XX.UI/js/jquery.dataTables.min.js" type="text/javascript"></script>
<link href="/_layouts/XX.XX.UI/css/datatable_css.css" rel="stylesheet" type="text/css" />
Script include in the page
<script type="text/javascript">
function pageLoad() {
$('#<%=gvNews.ClientID%>').dataTable({
"bSort": false,
"bPaginate": true,
"sPaginationType": "full_numbers"
});
}
</script>
Gridview prerender needs to be include
protected void gvNews_PreRender(object sender, EventArgs e)
{
try
{
if (gvNews.Rows.Count > 0)
{
//This replaces <td> with <th> and adds the scope attribute
gvNews.UseAccessibleHeader = true;
//This will add the <thead> and <tbody> elements
gvNews.HeaderRow.TableSection = TableRowSection.TableHeader;
//This adds the <tfoot> element.
//Remove if you don't have a footer row
gvNews.FooterRow.TableSection = TableRowSection.TableFooter;
}
}
catch (Exception ex)
{
Logger.LogEntry("News webpart, gvNews_PreRender method : " + ex.Message);
}
}
Reference:
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/default.html