Answered by:
Trying to use the GridViewPager usercontrol in other pages that dont use dynamic data.

Question
-
User-1759624489 posted
Hello.
I liked a lot the gridviewpager user control used on dynamic data.
I am trying to use it in other pages but I am a bit lost.
I put the pager on the pager template
but it doesnt work, when I change the dropdownlist to show 5 items per page, the whole gridview disappears.
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>I also put this code
protected void grvEmergencias_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grvEmergencias.PageIndex = e.NewPageIndex;
grvEmergencias.DataBind();
}
Monday, October 6, 2008 7:07 PM
Answers
-
User-1759624489 posted
I had to put the following code in the codebehind.
The good thing about dynamic data pages, is that this code isnt there
protected void grvEmergencias_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
BindEmergency();
grvEmergencias.PageIndex = e.NewPageIndex;
grvEmergencias.DataBind();
}
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 7, 2008 9:34 AM
All replies
-
User660823006 posted
I used the following markup against a page using Northwind and had not problems. There is nothing in the pager that is specific to Dynamic Data, we just included it to give a prettier representation for the default pages:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="LinqDataSource1"> <Columns> <asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False" ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" /> <asp:BoundField DataField="SupplierID" HeaderText="SupplierID" SortExpression="SupplierID" /> <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" /> <asp:BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit" /> <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" /> <asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock" /> <asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder" /> <asp:BoundField DataField="ReorderLevel" HeaderText="ReorderLevel" SortExpression="ReorderLevel" /> <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" /> </Columns> <PagerTemplate> <uc1:GridViewPager ID="GridViewPager1" runat="server" /> </PagerTemplate> </asp:GridView> <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="NorthwindDataContext" TableName="Products"> </asp:LinqDataSource>Tuesday, October 7, 2008 12:01 AM -
User-1759624489 posted
I had to put the following code in the codebehind.
The good thing about dynamic data pages, is that this code isnt there
protected void grvEmergencias_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
BindEmergency();
grvEmergencias.PageIndex = e.NewPageIndex;
grvEmergencias.DataBind();
}
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 7, 2008 9:34 AM