Dynamic data web application. How to change the default filter so that it displays more than 10 lines?

Dynamic Data Web Application

How to change the default filter so that it displays more than 10 lines?

I recently created the Dynamic Data website to help manage dozens of lookup tables for my business intelligence data warehouse, and I am having problems manipulating the template. I would like to make the default number of rows displayed on detail pages more than 10 rows. Although I found a part of the data grid that allows me to modify the drop-down list of filters, I still cannot find the code that causes the data grid to show only 10 rows. How do I change the default number of rows displayed by the data grid in the standard Dynamic Data website template?

+5
source share
3 answers

If you open the ~ / DynamicData / Content folder, you will find the pager in GridViewPager.ascx. You can edit this, since this is the pager used for all gridviews, in the code you will see this field at the top

You can change the number of lines per page per page, or you can set a default value in the code.

protected void Page_Load(object sender, EventArgs e)
{
    Control c = Parent;
    while (c != null)
    {
        if (c is GridView)
        {
            _gridView = (GridView)c;
            break;
        }
        c = c.Parent;
    }
    ***_gridView.PageSize = 20;***
}

Add a line to BOLD ITALIC to set the initial page size and change the value of the page size that it will list, edit the page yourself:

<asp:DropDownList ID="DropDownListPageSize" runat="server" 
    AutoPostBack="true" 
    CssClass="droplist" 
    onselectedindexchanged="DropDownListPageSize_SelectedIndexChanged">
    <asp:ListItem Value="5" />
    <asp:ListItem Value="10" />
    <asp:ListItem Value="15" />
    <asp:ListItem Value="20" />
</asp:DropDownList>
+5
source

It is in the gridview control (~ \ DynamicData \ PageTemplates \ List.aspx)

<asp:Gridview PageSize="20" runat="server" ID="GridView">

, PageSize , , .

+4

A Wizzard post did it for me!

I added:

if (!IsPostBack)
        {
            _gridView.PageSize = 100;
        }

so that the selector works anyway.

+3
source

All Articles