Trying to quickly create paginated grid. So i am using ListView.
Unfortunatelly pagination works a little strange.
Pagination control appears correctly.
But when i click "2" page postback happens but current page is still first
page. Then i click "3" page. Postback happens but current page is now "2"
page. Then i click "4" page and again postback happens and page 3 becomes
current.
Why is that? How to make it work?
Bellow you can find my code (Nothing else like code or any other control is
on the page)
thanks
George.
-----------------
protected override void OnInit(EventArg s e)
{
if( !isPostBack )
{
grdItems.DataSo urce = clsGlobal.GetDa ta("SELECT Id,Name FROM
tblMy");
grdItems.DataBi nd();
}
}
----------------------
<asp:ListView ID="grdItems" runat="server" DataKeyNames="I D">
<LayoutTemplate >
<table>
<tr class="gridhead er">
<td class="gridhead ercolumn">Id</td>
<td class="gridhead ercolumn">Name</td>
</tr>
<tr runat="server" id="itemPlaceho lder"></tr>
</table>
<asp:DataPage r runat="server" ID="DataPager" PageSize="3" >
<Fields>
<asp:NumericPag erField ButtonCount="5" PreviousPageTex t="<--"
NextPageText="-->" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate >
<tr class=griditem>
<td class="griditem column"><%# Eval("Id") %></td>
<td class="griditem column"><%# Eval("Name") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
Unfortunatelly pagination works a little strange.
Pagination control appears correctly.
But when i click "2" page postback happens but current page is still first
page. Then i click "3" page. Postback happens but current page is now "2"
page. Then i click "4" page and again postback happens and page 3 becomes
current.
Why is that? How to make it work?
Bellow you can find my code (Nothing else like code or any other control is
on the page)
thanks
George.
-----------------
protected override void OnInit(EventArg s e)
{
if( !isPostBack )
{
grdItems.DataSo urce = clsGlobal.GetDa ta("SELECT Id,Name FROM
tblMy");
grdItems.DataBi nd();
}
}
----------------------
<asp:ListView ID="grdItems" runat="server" DataKeyNames="I D">
<LayoutTemplate >
<table>
<tr class="gridhead er">
<td class="gridhead ercolumn">Id</td>
<td class="gridhead ercolumn">Name</td>
</tr>
<tr runat="server" id="itemPlaceho lder"></tr>
</table>
<asp:DataPage r runat="server" ID="DataPager" PageSize="3" >
<Fields>
<asp:NumericPag erField ButtonCount="5" PreviousPageTex t="<--"
NextPageText="-->" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate >
<tr class=griditem>
<td class="griditem column"><%# Eval("Id") %></td>
<td class="griditem column"><%# Eval("Name") %></td>
</tr>
</ItemTemplate>
</asp:ListView>