Hello!
I use a Ultrawebgrid with XML-load on demand and a RowsRange of 30
Because of bad performance with 30000 rows, i made my own IEnumberable datasource for returning only the rows i want. But there is another problem: the ultrawebgrid fetchs every single row, don't mather if it's displayed or not.
Now my question: is there a way to tell the grid, that it has to load only the displayed rows?
Yes! You can absolutely do this. The eventargs in the InitializeDataSource event can be upcast to "DataSourceEventArgs" which provides Partial DataBinding support. (http://help.infragistics.com/Help/NetAdvantage/NET/2007.3/CLR2.0/html/Infragistics2.WebUI.UltraWebGrid.v7.3~Infragistics.WebUI.UltraWebGrid.DataSourceEventArgs.html)
On a side note. The WebGrid is designed to support paging functionality provided by the DataSourceControl it is bound to. In .NET 2.0, the ObjectDataSource provides paging capabilities, and hence the grid can take advantage of that. I have a post on my blog which explains how to leverage this for probably the most efficient grid combo you'll ever see. https://ko.infragistics.com/community/blogs/b/tony_lombardo/posts/high-performance-databinding-for-asp-net-a-true-story
Hope this helps,
-Tony
Hello Tony!
Thank you for your response!
I'll try to discribe my problem in a different way:I made my own class:Class MyEnumeratorImplements IEnumerator
the Public ReadOnly Property Current() - methode is called by the grid for every row. Don't mather if the row is needed or not. Unfortunately ther's no method like "getUpperBound" in IEnumerator so the only way is "MoveNext()" 'til false is returned. But the call of "Current()" for undisplayed rows is unneeded.regards, Philipp
I forgot: I have to use the virtual XMLLoadOnDemandType
I was able to succefully implement this kind of binding by modifying the MoveNext function in order to Skip top currentRowCount enumeration and enumerate only the DataPortionSize rows needed for the partial binding
Like this
/// <summary> /// MOVE NEXT /// </summary> /// <returns></returns> public bool MoveNext() { moveNextCount++; //Skip Rows bool _success = false; while (currentRowCount > 0) { currentRowCount--; _success = respondentEnumerator.MoveNext(); if (_success == false) break; } _success = respondentEnumerator.MoveNext(); if ( _success ) { currentRowCount = 0; string _key = (string)respondentEnumerator.Current; Respondent _resp = viewManager.respondentCentral.Respondents[_key]; current = new ViewOpenEndBrowser(_resp, additionalInfo); } //Check if we have to stop the enumeration if (viewManager.DataPortionSize > 0 && getCurrentCount > viewManager.DataPortionSize) { //Get Current limits reach //Reset Counter getCurrentCount = 0; //Stop the enumaration return false; } return _success; }
Philipp,
The grid has no way of guessing what behavior you want it to provide with your enumerator. It cannot know where to start off or where to stop because it's an enumerator, nor can it assume that it should just start reading from the current spot. It treats the enumerator as a collection of values which it must display. It will enumerate through every value and then determine which values are necessary to fill the current request.
Because of this, you need to help the grid understand exactly what you need by using the initializedatasource method as described above. By telling the grid that you are supporting partialdatabinding and providing it with the next N rows, you can ensure that it doesn't loop through unnecessary rows in your datasource.