Periyannan G

Periyannan G

  • NA
  • 45
  • 68.1k

Datapager Control is not working fine?

Aug 2 2011 12:30 AM
i am using list view to bind some data from database using stored procedure, for paging i use "data pager". code will paste under.
 
at the time of execution,i click 2 page it displays some duplicate data's,those data's already bind in first page.

if I have 12 datas in database as per my code in first page 10 data's can be bound correctly,if i click 2 page it displays again 10 datas. 2 must be display but instead of 10 displays(the remaining 8 are already bind in first page).


Datapager code:

<asp:DataPager runat="server" ID="Pager2" PageSize="10" PagedControlID="lstView">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Link"  FirstPageText="&lt;&lt;"  ShowFirstPageButton="true"  ShowPreviousPageButton="false" ShowNextPageButton="false" />

        <asp:NumericPagerField />

        <asp:NextPreviousPagerField ShowLastPageButton="true" ButtonType="Link" LastPageText="&gt;&gt;" ShowPreviousPageButton="false" ShowNextPageButton="false"  />       
                        </Fields>
                    </asp:DataPager>

SQL Stored procedure:

CREATE PROCEDURE [dbo].[sp_nhomenews]
   
   
AS
BEGIN
   
    SET NOCOUNT ON;

   
    SELECT dbo.Category_Master.Category_Name, dbo.News_Master.Title, dbo.News_Master.Short_Description, dbo.News_Master.Long_Description,
                      dbo.News_Master.Image_Path, dbo.News_Master.CtereatedOn, dbo.News_Master.PK_NewsId
FROM         dbo.Category_Master INNER JOIN
                      dbo.News_Master ON dbo.Category_Master.PK_CategoryId = dbo.News_Master.FK_Category_Id
WHERE     (dbo.News_Master.FK_Category_Id = 1 or dbo.News_Master.FK_Category_Id = 2) order by dbo.News_Master.PK_NewsId Desc

END



Please any one tell me the idea or solution to solve this.


Answers (1)