E
Ed Klein
I have a custom page-navigation control (similar to the one from the
DataGrid class) implemented as a UserControl. I'd like to place it at both
the top and bottom of the container that lists my data items, in the same
way that the DataGrid's "TopAndBottom" pager style works. I'm not using a
DataGrid, so I need to do this myself. The obvious way, which seems
tedious, is like this:
<MyNamespace:MyPager id="Pager1" runat="server" />
<MyNamespace:MyDataList id="MyList" runat="server" />
<MyNamespace:MyPager id="Pager2" runat="server" />
And in the code:
Pager1.PageSize = 10;
Pager2.PageSize = 10;
Pager1.CurPos = 30;
Pager2.CurPos = 30;
Pager1.DataBind();
Pager2.DataBind();
and so on. Both instances of "MyPager" look exactly the same and are
databound with exactly the same data. Seems like it would be easier to just
have one instance of the pager, but allow it to somehow render itself twice
on the containing page, so I wouldn't have to have all these duplicate lines
of code. Is this possible in ASP.NET?
DataGrid class) implemented as a UserControl. I'd like to place it at both
the top and bottom of the container that lists my data items, in the same
way that the DataGrid's "TopAndBottom" pager style works. I'm not using a
DataGrid, so I need to do this myself. The obvious way, which seems
tedious, is like this:
<MyNamespace:MyPager id="Pager1" runat="server" />
<MyNamespace:MyDataList id="MyList" runat="server" />
<MyNamespace:MyPager id="Pager2" runat="server" />
And in the code:
Pager1.PageSize = 10;
Pager2.PageSize = 10;
Pager1.CurPos = 30;
Pager2.CurPos = 30;
Pager1.DataBind();
Pager2.DataBind();
and so on. Both instances of "MyPager" look exactly the same and are
databound with exactly the same data. Seems like it would be easier to just
have one instance of the pager, but allow it to somehow render itself twice
on the containing page, so I wouldn't have to have all these duplicate lines
of code. Is this possible in ASP.NET?