GridView (RadGrid) and custom paging

Ok, so I'm trying to set up my custom paging on Telerik RadGrid (similarly asp:Gridview), but I still click on the wall. (the first part of my question was answered here )

So, I implemented this proposal. I use the following stored code

ALTER PROCEDURE [dbo].[bt_HealthMonitor_GetAll]
(
    @StartRowIndex      int,
    @MaximumRows        int
)

AS
SET NOCOUNT ON

Select
RowNum,
[ID],
[errEx],
[errURL],
[errSource],
[errUser],
[errMessage],
[errIP],
[errBrowser],
[errOS],
[errStack],
[errDate],
[errNotes]
From
(
Select
    [ID],
    [errEx],
    [errURL],
    [errSource],
    [errUser],
    [errMessage],
    [errIP],
    [errBrowser],
    [errOS],
    [errStack],
    [errDate],
    [errNotes],
    Row_Number() Over(Order By [ID]) As RowNum
    From dbo.[bt_HealthMonitor] t
) 
As DerivedTableName
Where RowNum Between @StartRowIndex And (@StartRowIndex + @MaximumRows)

Order By [ID] Desc

Then another stored procedure to get the number of records

ALTER PROCEDURE [dbo].[bt_HealthMonitor_GetRecordCount]

AS
SET NOCOUNT ON

return (Select Count(ID) As TotalRecords From bt_HealthMonitor)

And I use LINQ to SQL to bind to my RadGrid

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)

    Dim startRowIndex As Integer = (RadGrid1.CurrentPageIndex * RadGrid1.PageSize)
    Dim maximumRows As Integer = RadGrid1.PageSize

    Dim HealthMonitorDC As New DAL.HealthMonitorDataContext

    Dim r = HealthMonitorDC.bt_HealthMonitor_GetAll(startRowIndex, maximumRows)
    RadGrid1.DataSource = r
End Sub

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
    Dim HealthMonitorDC As New DAL.HealthMonitorDataContext
    Dim count = HealthMonitorDC.bt_HealthMonitor_GetRecordCount()
    RadGrid1.MasterTableView.VirtualItemCount = count.ReturnValue
    RadGrid1.VirtualItemCount = count.ReturnValue
End Sub

But the problem I ran into is that the grid only captures the first 10 rows (as expected), but I need to get it so that it recognizes that there are 200 rows in the table so that the swap icons are displayed.

50 , 50, , 50.

?

+5
3

, . grid VirtualItemCount ( ).

. - .

+14

VirtualItemCount. - NeedDataSource.

, , . , 14 5 , , 4 .

( ):

    If gridRecords.Count < (grid.pagesize * (grid.pageIndex + 1)) Then
        gridRecords.GetRange(grid.pageIndex * grid.pagesize, gridRecords.Count - (grid.pagesize * grid.pageIndex))
    Else
        gridRecords.GetRange(grid.pageIndex * grid.pagesize, grid.pagesize)
    End If

, , .

+1

ObjectDataSource.

http://www.unboxedsolutions.com/sean/archive/2005/12/28/818.aspx

i.e RadGrid ObjectDataSource CustomPaging i.e .

ObjectDataSource 1. SelectMethod ( , ) 2. SelectCountMethod ( , )

0
source

All Articles