This is a migrated thread and some comments may be shown as answers.

Pager not Obeying Property Assignment - [CLASSIC Controls]

9 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 May 2011, 03:56 AM
Hi,

I'm working on a project whereby we are augmenting the functionality of an existing application which was built using the ASP.NET AJAX classic controls. (The analysis of upgrading to the current control suite determined that this would take to long).

So, using the WCSF and the MVP pattern, I am trying to re-apply state to a Grid. Here are the circumstances:
- user performs search
- user clicks on item in grid and is navigated to a page for that one item to edit
- as part of that operation, the state of the Grid is saved into a Session object (i.e. CurrentPage, PageSize)
- user clicks on a "Return to Search" button.
- upon loading the Grid and populating it, the Presenter applies its stored state to the Grid (i.e.CurrentPage, PageSize)

The result is a bit off. The results that are displayed are fine. However, the Pager TextBoxes and LinkButtons are all out of whack. That is, even though there may be 4 items in the Grid (as per the previously selected PageSize), the Page Size TexBox will have reverted to its original value of 10, the Page index will be 1 (even though the result set is the 4th page) and the pager LinkButton which is colored as active is the 1st page index (i.e. 1).

I've set the properties as so, and when debugging, the values seem to be assigned perfectly well:
public int LicencesResultsPageSize
{
    get
    {
        if (this.LicenceResultsPanel.Visible)
        {
            return this.LicenceResultsGrid.MasterTableView.PageSize;
        }
        return 0;
    }
    set
    {
        if (this.LicenceResultsPanel.Visible)
        {
            this.LicenceResultsGrid.MasterTableView.PageSize = value;
        }
    }
}
 
public int LicencesResultsPageIndex
{
    get
    {
        if (this.LicenceResultsPanel.Visible)
        {
            return this.LicenceResultsGrid.MasterTableView.CurrentPageIndex;
        }
        return 0;
    }
    set
    {
        if (this.LicenceResultsPanel.Visible)
        {
            this.LicenceResultsGrid.MasterTableView.CurrentPageIndex = value;
        }
    }
}

Does anyone know of a way to get those pager controls in Sync with the actual results?

9 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 12 May 2011, 08:08 AM
Hello David,

Thank you for contacting us.

Based on the supplied information, it is hard to determine what is causing the unwanted behavior at your end. Could you please send us a small runnable project which demonstrates the described issue.
Thus we will be able to gather more details about your scenario, debug the project and provide you with more to-the-point answer.

Looking forward for your reply.

Greetings,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 17 May 2011, 05:26 AM
Hi Radoslav,

Unfortunately I have not been able to reproduce the bug in a sample project.
It is still very much alive in the enterprise app that we are building.

So, there's not too much you can do to help. If you do thing of anything which might fit the symptoms (i.e. pager control getting out of sync with the actualy results) from your previous experience, that would be great.

Otherwise, thanks for your time.
0
Radoslav
Telerik team
answered on 19 May 2011, 01:27 PM
Hello David,

I understand that your project is big and it is complicated, however you could send us a small piece of it. To recreate a problem in small project is not so hard as it looks like. You could send us a several files which is connected to a page in which the problem is reproduced.  If you have worries about sending us the database you could create a small database which contains only several tables from the real database. If we have the project we will be able to gather more details about your scenario and provide you with more to-the-point answer.

Kind regards,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 25 May 2011, 01:42 AM
Hi Radoslav,

I have created a sample project which does the same thing and is implemented the same way. Only, it is using the Adventure Works database.
You can download it from here.

I could not re-create the bug, but it does show exactly how I have gone about re-applying state upon a return to search.

If you can help, that would be great. But I understand that it will be very difficult without actually having at the actual code itself.

Cheers
0
Radoslav
Telerik team
answered on 27 May 2011, 10:19 AM
Hello David,

I tried to run the application, however I received the following error:
Could not find stored procedure 'GetAllPersons' (picture is attached).
Could you please send us the declaration of the 'GetAllPersons' stored procedure and steps for reproducing the described problem. Thus we will be able to run the application, debug it and investigate the problem.

Looking forward for your reply.

Best wishes,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 30 May 2011, 12:48 AM
My apologies (sorry for wasting your time). I meant to include that script in the zip file. It is:
USE [AdventureWorks]
GO
 
/****** Object:  StoredProcedure [dbo].[GetAllPersons]    Script Date: 05/30/2011 09:13:41 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetAllPersons]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetAllPersons]
GO
 
USE [AdventureWorks]
GO
 
/****** Object:  StoredProcedure [dbo].[GetAllPersons]    Script Date: 05/30/2011 09:13:41 ******/
SET ANSI_NULLS ON
GO
 
SET QUOTED_IDENTIFIER ON
GO
 
 
CREATE PROCEDURE [dbo].[GetAllPersons]
    -- Add the parameters for the stored procedure here
    /* paging variables */
    @OrderBy VARCHAR (256)
    ,@PageIndex INT
    ,@PageSize INT
    ,@TotalRecords INT OUTPUT  
     
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
 
    -- Insert statements for procedure here
    ; WITH selectPersonPages AS
    (
        SELECT DISTINCT ROW_NUMBER() OVER (ORDER BY @OrderBy ASC) AS RowNum
            , ContactID
            , NameStyle
            , Title
            , FirstName
            , MiddleName
            , LastName
            , Suffix
            , EmailAddress
            , Phone
        FROM        
            Person.Contact
    )  
        SELECT ContactID
            , NameStyle
            , Title
            , FirstName
            , MiddleName
            , LastName
            , Suffix
            , EmailAddress
            , Phone
        FROM
            selectPersonPages
        WHERE
            RowNum BETWEEN ((@PageSize * @PageIndex) + 1) AND (@PageSize * (@PageIndex + 1))
        ORDER
            BY RowNum ASC
             
    SELECT @TotalRecords = COUNT(ContactID) FROM Person.Contact            
END
 
GO

Remember that I was not able to reproduce the bug in that example project. But it will show you how I have gone about it in the real project.

Thanks
.
0
Radoslav
Telerik team
answered on 01 Jun 2011, 09:21 AM
Hello David,

Thank you for providing the GetAllPersons stored procedure. I successfully run and tested the application. Unfortunately I am not able to reproduce the described issue. Everything works as expected. Also I reviewed the source code and it looks correct. It is hard to say what is causing the described issue without reproduce it on my side. Additionally could you please verify that in the original project when you perform paging or apply the search criteria only the items for the current page are extracted from the data source and passed to the RadGrid.

Looking forward for your reply.

Regards,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 06 Jun 2011, 08:53 AM
Hi Radoslav,

I confirm that only the number of results that are meant for that page (e.g. 6) are being applied to the DataScource for the grid. Not the total count for all the pages.

Thanks very much for your help. It makes it tricky when we cannot reproduce the bug in an example project. Right now, my colleague and I are completely puzzled as to why the behaviour is not the exact same.

Anyhow, thanks again.
0
Radoslav
Telerik team
answered on 09 Jun 2011, 07:59 AM
Hi David,

I am not sure what could be the reason for experiencing the described problem. If you could reproduce the described issue into a simple application feel free to send it to us. We will debug it locally, and get back to you with additional information on the matter.

Greetings,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
David
Top achievements
Rank 1
Share this question
or