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

[Solved] Performance on firing of SelectedIndexChanged event

10 Answers 196 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 23 Oct 2009, 08:54 PM
Hi,

I am using the RadGrid for AJAX and have enabled client-side select.

I have noticed that the process time for SelectedIndexChanged Event is directly proportional to the number of items in the grid.
Because I have an empty event handler that handles the SelectedIndexChanged Event, but the more items I have in the grid the longer the loading panel stays on the page.
Is this the case? If so, is there a way to optimize it?

Thanks,
Vincent

10 Answers, 1 is accepted

Sort by
0
SamJ
Top achievements
Rank 1
answered on 24 Oct 2009, 07:36 AM
Hi,

To optimize the grid performance in your case, you can try using client-side slection for RadGrid:

http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx

I hope this helps.
SamJ


0
Vincent
Top achievements
Rank 1
answered on 26 Oct 2009, 09:00 PM
Hi SamJ,

I took a look at the post and modified my code a bit. 

_theListGrid =

new RadGrid();

 

_theListGrid.ID =

"Master_List";

 

_theListGrid.AutoGenerateColumns =

false;

 

_theListGrid.ShowHeader =

true;

 

_theListGrid.BorderStyle =

BorderStyle.None;

 

 

 

_theListGrid.ClientSettings.EnablePostBackOnRowClick =

true;

 

_theListGrid.ClientSettings.Selecting.AllowRowSelect =

true;

But the line _theListGrid.SelectedItems.Count gives me 0

Am I missing something here?
Please advise.

What I need to do is to client select a row, and use the item id of this row to populate the item detail.

Thanks,
Vincent

 

0
Vincent
Top achievements
Rank 1
answered on 28 Oct 2009, 01:59 PM
Hi,

Please confirm this:

process time for SelectedIndexChanged Event is directly proportional to the number of items in the grid.

I realized that the more items I have in the grid the longer the SelectedIndexChanged event takes to load, even without implementing any code in the event handler.

Thanks,
Vincent



0
Iana Tsolova
Telerik team
answered on 29 Oct 2009, 09:33 AM
Hi Vincent,

From the pasted code I can see that you have set the EnablePostBackOnRowClick property to true. However, this is making the rows selection a server-side one rather than client as postback is performed when you select an item. After this postback all page controls are repopulated so it is true that much controls or grid rows you have the more time the reloading takes.
In order to optimize you page performance, I would suggest you to use ajax and thus update only the details area on rows selection instead the current server-side selection. For that purpose, you can handle the OnRowSelected or OnRowClick client-side event of RadGrid and invoke manual ajax requests as shown here.

Give it a try and let me know if you need further directions/help.

Regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Vincent
Top achievements
Rank 1
answered on 30 Oct 2009, 07:40 PM
Hi,

I have included the code in my component.
But $find('"+_mainUpdatePanel.ClientID+"') seems to return null.




Javascript function
function GridCustomAjax() 
$find('"+_mainUpdatePanel.ClientID+"').ajaxRequest('"+_theListGrid.ClientID+"'); 
 

RadGrid
            _theListGrid = new RadGrid(); 
            _theListGrid.ID = "Master_List"
            _theListGrid.AutoGenerateColumns = false
            _theListGrid.ShowHeader = true
            _theListGrid.BorderStyle = BorderStyle.None; 
            _theListGrid.ClientSettings.Selecting.AllowRowSelect = true
            _theListGrid.ClientSettings.ClientEvents.OnRowClick = "GridCustomAjax"

RadAJAXPanel
                this._mainUpdatePanel = new RadAjaxPanel(); 
                this._mainUpdatePanel.ID = "MainUpdatePanel"
                this._mainUpdatePanel.LoadingPanelID = "myLoadingPanel"
                this._mainUpdatePanel.EnableAJAX = true
                this._mainUpdatePanel.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(_mainUpdatePanel_AjaxRequest); 
 
        void _mainUpdatePanel_AjaxRequest(object sender, AjaxRequestEventArgs e) 
        { 
            if (e.Argument == _theListGrid.ClientID) 
            { 
                GridDataItem itemSelected = null
 
                if (_theListGrid.SelectedItems[0] is GridDataItem) 
                    itemSelected = (GridDataItem)_theListGrid.SelectedItems[0]; 
 
                if (itemSelected != null
                { 
                    MakeDetailPanel(_theList, _selectedItemID.Text); 
                } 
            } 
        } 



0
Iana Tsolova
Telerik team
answered on 03 Nov 2009, 01:16 PM
Hello Vincent,

I can see you are creating the RadAjaxPanel dynamically. Please confirm that you are adding it to the form controls collection on Page_Init but later. Additionally, verify that you are trying to access its ClientID after you added it to the page/form.

All the best,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Vincent
Top achievements
Rank 1
answered on 03 Nov 2009, 06:43 PM
Hi,

Ok, I have successfully implemented the solution and am able to manually trigger the AJAX request.

But the process time did not improve. The time is still proportional to the number of items within the grid.

Please advise.

Thanks,
Vincent

Here's what I have set for RadGrid:
            _theListGrid = new RadGrid(); 
            _theListGrid.ID = "Master_List"
            _theListGrid.AutoGenerateColumns = false
            _theListGrid.ShowHeader = true
            _theListGrid.BorderStyle = BorderStyle.None; 
            _theListGrid.MasterTableView.AlternatingItemStyle.CssClass = "listItemBg"
            _theListGrid.MasterTableView.ItemStyle.CssClass = "listItemBg"
            _theListGrid.MasterTableView.HeaderStyle.CssClass = "listHeaderTwo"
            _theListGrid.MasterTableView.SelectedItemStyle.CssClass = "listItemBgOver"
            //_theListGrid.ClientSettings.EnablePostBackOnRowClick = true
            _theListGrid.ClientSettings.Selecting.AllowRowSelect = true
            //_theListGrid.SelectedIndexChanged += new EventHandler(_theListGrid_SelectedIndexChanged); 
            _theListGrid.Skin = AW.Common.Constants._radGridSkin; 
             
            _theListGrid.PageSize = NumRows
            _theListGrid.AllowPaging = true
            _theListGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; 
            _theListGrid.PagerStyle.ShowPagerText = false
            _theListGrid.PagerStyle.AlwaysVisible = true
            _theListGrid.PagerStyle.CssClass = "grid_announcements_pager"
            _theListGrid.ClientSettings.ClientEvents.OnRowClick = "GridCustomAjax"

0
Iana Tsolova
Telerik team
answered on 05 Nov 2009, 09:39 AM
Hello Vincent,

Could you please confirm that on ajax request you are not updating the grid but only the details content area? So the RadAjaxPanel should be wrapped only around the item details and to wrapping the grid.
If the problem persists, I suggest that you open a formal support ticket and send me a sample application of your scenario there for further investigation.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Anthony
Top achievements
Rank 1
answered on 10 Nov 2009, 03:28 PM
Hi Iana,

I have submitted a formal support ticket. Can you please take a look at it?

Support ID: 257038

Thanks,
Vincent
0
Iana Tsolova
Telerik team
answered on 13 Nov 2009, 12:26 PM
Hi Anthony,

Thank you for opening a formal support ticket. We will have a look at it and do our best to help you.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Vincent
Top achievements
Rank 1
Answers by
SamJ
Top achievements
Rank 1
Vincent
Top achievements
Rank 1
Iana Tsolova
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or