以下內容添加到RenderContents在GridViewAdapter.cs前右/ //// BODY //// /////////////// EmptyDataTemplate ///////////////////////
if (gridView.Rows.Count == 0) {
//Control[0].Control[0] s/b the EmptyDataTemplate.
if (gridView.HasControls()) {
if (gridView.Controls[0].HasControls()) {
if (gridView.Controls[0].Controls[0] is GridViewRow) {
rows.Clear();
rows.Add(gridView.Controls[0].Controls[0]);
gvrc = new GridViewRowCollection(rows);
WriteRows(writer, gridView, gvrc, "tfoot");
}
}
}
}
並在返回className.Trim()之前向GetRowClass添加以下內容:
//// EmptyDataTemplate
if ((row.RowType & DataControlRowType.EmptyDataRow) == DataControlRowType.EmptyDataRow) {
className += " AspNet-GridView-Empty ";
}
最後,如果你想覆蓋標準TFOOT風格,
.AspNet-GridView table tfoot tr.AspNet-GridView-Empty td
{
}
引人入勝,2014年仍然沒有解決...至少被接受的答案仍然有效。 – walther 2014-11-19 13:43:16