1
Vote

GridView Adapter prevent Pager to show in Dynamic Data.

description

In a standard Dynamic data page (no customization) the pager of the gridview is not rendered if CSS Adapter is enabled for GridView control.
 
A workaround I found is to create a Custom Control:
<code>
namespace Infrastructure.CustomControls
{
public class CssGridView : GridView
{
    protected override void Render(System.Web.UI.HtmlTextWriter writer) { base.Render(writer);  }
}
}
</code>
 
then associate che Adapter to that control:
<code>
<adapter controlType="Infrastructure.CustomControls.CssGridView" adapterType="CSSFriendly.GridViewAdapter" />
</code>
 
And then register and use it in the pages I want a CSS Friendly GridView.
<code>
<%@ Register Assembly="Infrastructure" Namespace="CustomControls" TagPrefix="cc1" %>
[...]
<cc1:CssGridView ....>/cc1:CssGridView>
</code>
 
The dynamic Data ones will then use te standard GridView, not having the pager issue.

comments