Why performance of rad grid goes down dramatically when it has to display more than 50 rows. Scroll bar gets stuck.
Please suggest solution to improve performance as this has been acritical issue for this project.
Also i had requirement of having "All" as PageSize ComboBox item to display all items at one time in grid. So i customized the "
PageSizeComboBox" as follows:
Protected Sub grid_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grid.ItemCreated
If TypeOf (e.Item) Is GridPagerItem Then
Dim pageBoundItem As GridPagerItem = DirectCast(e.Item, GridPagerItem)
Dim PageSizeComboBox As RadComboBox = TryCast(pageBoundItem.FindControl("PageSizeComboBox"), RadComboBox)
If PageSizeComboBox IsNot Nothing Then
'Start **Page Size initialization
Dim itemIndex As Integer = 0
Dim minPageSize As Integer
Dim maxPageSize As Integer
Dim pageSizeStep As Integer
Integer.TryParse(ConfigurationManager.AppSettings("MinPageSize").ToString(), minPageSize)
Integer.TryParse(ConfigurationManager.AppSettings("MaxPageSize").ToString(), maxPageSize)
Integer.TryParse(ConfigurationManager.AppSettings("PageSizeStep").ToString(), pageSizeStep)
'End **Page Size initialization
Dim ComboItem As RadComboBoxItem
For iCount As Integer = minPageSize To maxPageSize Step pageSizeStep
Dim newComboItem As RadComboBoxItem = PageSizeComboBox.Items.FindItemByValue(iCount)
If newComboItem Is Nothing Then
ComboItem = New RadComboBoxItem(iCount.ToString(), iCount.ToString())
ComboItem.Attributes.Add("ownerTableViewId", gridClientId)
PageSizeComboBox.Items.Insert(itemIndex, ComboItem)
End If
itemIndex += 1
Next
Dim newItem As RadComboBoxItem = PageSizeComboBox.Items.FindItemByValue(gridDataItemCount.ToString())
If newItem Is Nothing Then
ComboItem = New RadComboBoxItem("All", gridDataItemCount.ToString())
ComboItem.Attributes.Add("ownerTableViewId", gridClientId)
PageSizeComboBox.Items.Insert(PageSizeComboBox.Items.Count, ComboItem)
Else
newItem.Text = "All"
End If
AddHandler PageSizeComboBox.SelectedIndexChanged, AddressOf Me.PageSizeComboBox_SelectedIndexChanged
PageSizeComboBox.AutoPostBack = True
End If
End If
End Sub
Public Sub PageSizeComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
Dim intPageSize As Integer
Integer.TryParse(e.Value, intPageSize)
ViewState("intPageSize") = intPageSize.ToString()
grid.PageSize = ViewState("intPageSize")
grid.Rebind()
End Sub
Protected Sub grid_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid.NeedDataSource
If ViewState("gridData") IsNot Nothing Then
grid.VirtualItemCount = CType(ViewState("gridData"), DataTable).Rows.Count
grid.DataSource = CType(ViewState("gridData"), DataTable)
Else
grid.VirtualItemCount = 0
grid.DataSource = Nothing
End If
End Sub