52 Answers, 1 is accepted
Thank you for this question.
We do not support such a feature in RadGridView because in a desktop application there is no need to use paging. In the web one would prefer to keep the broadband as low as possible, however on a desktop there are no such limitations. Could you give us more details on this feature? It is possible that your case is rather specific, so we would like to hear it.
Thanks in advance.
Greetings,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for this response.
Unfortunately, paging is not in our TODO list for the moment. We will reconsider this if more people request the same feature. In a WinForms application it preferable to use the scrollbars instead of paging. If you need paging functionality, it is relatively simple to implement it for a custom scenario.
Don't hesitate to contact us if you have other questions.
All the best,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Best wishes,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I mean, your solution is probably a good way to go, and would work.. it's just the underlying design decision I'd question :).
There are several different approaches when loading large datasets, for example paging (used mostly in ASP.NET datagrids), virtualization, etc.
We are working/researching three different approaches for the RadGridView at the moment. Whether all or some of them will be implemented depends on the approach's metrics and stability. We are still collecting data through tests and time will tell which ones will appear in the next RadGridView version. Nevertheless, we will be glad to hear your opinion on these approaches.
Here they are:
- Virtualized grid (columns and rows) - this approach allows you to use the grid as a thin UI layer where all specific data logic could be put outside the control.
- Asynchronous binding - here a worker thread processes the data in the background, and periodically updates the internal data pool of the grid. Then the grid refreshes just after the required amount or UI artifacts are prepared.
- Paging the data source - this is the hardest one, in my believe. Not the implementations, but the specific logic needed for grouping/filtering/sorting (as those are processes that are placed after the data is processed internally by the grid).
Your feedback will be appreciated.
All the best,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
It's probably the least designer-friendly pick of the three, but I'd think that it would bump the grid to the next level in power & flexibility. Just so long as there is documentation :)
I have above 100,000 record. with loading all data into RAM and transmission in network, make performance decrease. for refreshing and loading new data it must repeat.
i think that paging is necessary for winform applications too.
Thank you for your opinion on this matter.
Currently, we do not have plans the implement paging in our RadGridView. However, your vote is appreciated and logged as a feature request into our tracking system.
Sincerely yours,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Dears,
Please note that we have 70,000+ records and we are facing major issues in loading them. It takes few seconds to get the records from the database, however. It takes long time trying to render them at the grid.
Finally, we would like to maintain the nice features of GridView e.g. Grouping, etc. Moreover, I believe powerful controls like RadControls for WinForms should be able to handle this number of records.
Best regards,
JValley Software Solutions
The Essence of Quality !!
Basheer, RadGridView supports row virtualization, so it is capable of loading and showing huge number of records. In other words, you should not experience any issues concerning this. However, if the number of columns is big, you may encounter a performance lag, because currently RadGridView does not support column virtualization. We are working on this feature and it will be implemented in one of our next versions.
As to the second issue, it will be best if you send us a sample project that reproduces the issue. This will allow us to investigate the case further, to address any potential issues and to suggest optimizations if such are possible.
Pawz, radGridView1.GridElement.BeginUpdate() and EndUpdate will indeed boost performance, but only if you are manually inserting numerous rows in RadGridView.
Kind regards,
Nikolay
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I agree, that a well structured SQL query can return many records very quickly, but actually rendering them to the screen takes many times longer.
It would certainly be a nice to have feature.
Richard
Thank you for your vote.
Please note that RadGridView uses virtualization for its cells, so not all the data cells are rendered. For additional information, refer to the following help article: Logical vs. Visual Grid Structure.
As to the paging feature, you can easily achieve such behavior using LINQ. For additional information, please refer to the following blog post: Emulating Paging with RadGridView for WinForms and LINQ with 1 million records.
Sincerely yours,
Nikolay
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
i have a application that calls the Data from a online server. So it basicly works like the ASP.net but is not a web solution.
therefore i'd like to page the data in so that the network connections are limited.
id there another way to do this in code maybe?
thanks
Thank you for your vote.
Please note that RadGridView is a UI control which just represents the data taken from a DataSource in a pleasant and understandable way. However, it is not a duty of RadGridView to take limited amount of data from your database. In case we decide to implement paging, it will be just a visual paging which will display a given number of records on a page. However, this feature will not limit the network connections.
You can refer to my previous post which gives a link to a page implementation with the help of LINQ to SQL.
Best wishes,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
guys you have to create the paging for the desktop application's because really it's needed as Luca Mancuso said and also
we have too much different scenario's that need paging
Thank you for your vote.
As I mentioned above, you can use the approach given in the following blog post: Emulating Paging with RadGridView for WinForms and LINQ with 1 million records.
Currently, I am not able to provide you with a specific time frame concerning the built-in paging feature.
Regards,
Nikolay
the Telerik team
I ve same scenario, where there are 20,000 rows which are having grouping facility.
Also, one columns is continuiosly updating value like Price of stock, some of the columns have expression using that price of stock.
Now on continuous Refreshing of Price is making Grid unresponsive to user.
Thats why i am seraching for resolving issue.
I found this forum, and some virstual mode function.
Is it possible to use this feature with DataTable as binding source????
Can you please provide sample code shows use of virtual mode in radgridview with Datatable binding?
Or Any other solution???
For more information on how to implement virtual mode for the RadGridView, please take a look at this help article.
But i have to warn you that from what i now, RadGridView does not process filtering, sorting, and grouping in Virtual Mode. Only the UI and expression collections are updated.
You can use FilterChanged, SortChanged, and GroupByChanged events to implement you logic for virtual mode. The events notify for a change in the related expression collections and send updates to RadGridView UI to fire CellValueNeeded event to fill again the displayed cells in the current grid view.
There were some plans to include this in the future versions, but from what i know this hasn't happened yet.
But as the previous replies have stated, the fact of the matter is with Linq you are getting just the data you can see, and from what i understand, this could be a problem in your case because you need to be able to change the values on the entire DataSet, DataTable?
Another easier option is to use a timer, that would perform a refresh every x seconds.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Hey guys.
I have read this thread and i'd like to vote too.
I strongly believe that paging option in grid is one of the most important
(i mean in real projects, where the data is really big - thousands, maybe millions)
Hope this option will appear soon...
In order to make this voting easier, I have added this request to our Public Issue Tracking System where you can add your votes, comments and subscribe to the status updates regarding the feature. You can find the PITS item at this link.
Regards,
Stefan
the Telerik team
Thank you for your feedback. You can add your vote for this feature request in the provided link in my previous post.
Regards,
Stefan
the Telerik team
Please take a look at the following sample and let me know what you think. It's just a very basic example of paging using a command bar. Sorry that i didn't have time to make it cleaner and handle a few other details, like overflow and so on, but i hope this will put you on the right pat if you decide to use this:
First, the custom control:
using
System;
using
System.Collections;
using
System.Collections.Generic;
using
System.Linq;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
public
partial
class
GridWithPagingControl : UserControl
{
#region Constants and Fields
private
object
dataSource;
private
Dictionary<
int
,
object
> pagesDictionary;
private
Timer resizeTimer;
private
int
currentPageNo;
#endregion Constants and Fields
#region Constructors and Destructors
public
GridWithPagingControl()
{
InitializeComponent();
pagesDictionary =
new
Dictionary<
int
,
object
>();
resizeTimer =
new
Timer();
resizeTimer.Interval = 100;
resizeTimer.Tick +=
new
EventHandler(resizeTimer_Tick);
}
#endregion Constructors and Destructors
#region Overrides
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
}
protected
override
void
OnSizeChanged(EventArgs e)
{
base
.OnSizeChanged(e);
if
(radGridView1.DataSource ==
null
)
{
ClearPages();
radCommandBar1.Visible =
false
;
return
;
}
resizeTimer.Enabled =
false
;
resizeTimer.Enabled =
true
;
}
#endregion Overrides
#region Properties
public
RadGridView GridView
{
get
{
return
radGridView1;
}
}
public
object
DataSource
{
get
{
return
dataSource;
}
set
{
if
(dataSource != value)
{
dataSource = value;
if
(dataSource
as
IList ==
null
)
{
throw
new
ArgumentException(
"DataSource must be of IList type"
);
}
CreatePages();
SelectFirstPage();
}
}
}
public
int
CurrentPageNo
{
get
{
return
currentPageNo;
}
}
#endregion Properties
#region Public Methods
public
bool
SelectPage(
int
pageNo)
{
if
(!pagesDictionary.ContainsKey(pageNo))
{
return
false
;
}
radGridView1.DataSource = pagesDictionary[pageNo];
txtCurrentPage.Text = pageNo.ToString();
currentPageNo = pageNo;
var button = stripElementPages.Items.Where(b => b.Tag
is
int
&& ((
int
)b.Tag) == pageNo).FirstOrDefault()
as
CommandBarToggleButton;
if
(button !=
null
)
{
button.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
}
CheckNavigationButtonsState();
return
true
;
}
public
bool
SelectFirstPage()
{
return
SelectPage(pagesDictionary.Keys.FirstOrDefault());
}
public
bool
SelectLastPage()
{
return
SelectPage(pagesDictionary.Keys.LastOrDefault());
}
public
bool
SelectNextPage()
{
return
SelectPage(currentPageNo + 1);
}
public
bool
SelectPreviousPage()
{
return
SelectPage(currentPageNo - 1);
}
#endregion Public Methods
#region Event Handlers
void
resizeTimer_Tick(
object
sender, EventArgs e)
{
resizeTimer.Stop();
radCommandBar1.Visible =
true
;
CreatePages();
SelectFirstPage();
}
void
pageButton_ToggleStateChanged(
object
sender, StateChangedEventArgs args)
{
var button = sender
as
CommandBarToggleButton;
if
(button.ToggleState == Telerik.WinControls.Enumerations.ToggleState.Off)
{
return
;
}
var pageNo = -1;
int
.TryParse(button.Tag.ToString(),
out
pageNo);
if
(pageNo == -1)
{
return
;
}
//button.ToggleState = args.ToggleState;
var selectedbutton = stripElementPages.Items.Where(i =>
i
is
CommandBarToggleButton &&
((CommandBarToggleButton)i).ToggleState == Telerik.WinControls.Enumerations.ToggleState.On && i != button).FirstOrDefault()
as
CommandBarToggleButton;
if
(selectedbutton !=
null
)
{
selectedbutton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
}
if
(currentPageNo != pageNo)
{
SelectPage(pageNo);
}
}
void
pageButton_ToggleStateChanging(
object
sender, StateChangingEventArgs args)
{
args.Canceled = (stripElementPages.Items.Where(i =>
i
is
CommandBarToggleButton &&
((CommandBarToggleButton)i).ToggleState == Telerik.WinControls.Enumerations.ToggleState.On &&
args.NewValue == Telerik.WinControls.Enumerations.ToggleState.Off).ToArray().Length) == 1;
}
private
void
radGridView1_DataBindingComplete(
object
sender, Telerik.WinControls.UI.GridViewBindingCompleteEventArgs e)
{
}
private
void
btnFirst_Click(
object
sender, EventArgs e)
{
SelectFirstPage();
}
private
void
btnPrevious_Click(
object
sender, EventArgs e)
{
SelectPreviousPage();
}
private
void
btnNext_Click(
object
sender, EventArgs e)
{
SelectNextPage();
}
private
void
btnLast_Click(
object
sender, EventArgs e)
{
SelectLastPage();
}
private
void
brnSelect_Click(
object
sender, EventArgs e)
{
var pageNo = -1;
int
.TryParse(txtCurrentPage.Text,
out
pageNo);
if
(pageNo == -1)
{
return
;
}
SelectPage(pageNo);
}
#endregion Event Handlers
#region Methods
private
void
CheckNavigationButtonsState()
{
btnFirst.Enabled = currentPageNo != 1;
btnPrevious.Enabled = btnFirst.Enabled;
btnLast.Enabled = currentPageNo != pagesDictionary.Count;
btnNext.Enabled = btnLast.Enabled;
}
private
void
CreatePages()
{
ClearPages();
if
(dataSource ==
null
)
{
return
;
}
radGridView1.DataSource = dataSource;
radGridView1.LoadElementTree();
var numberOfRowsPerPage = radGridView1.GridElement.VisualRows.Count(c => c.RowInfo
is
GridViewDataRowInfo) - 1;
var list = dataSource
as
IList;
pagesDictionary.Clear();
IList pageSource =
null
;
for
(
int
i = 0; i < list.Count; i++)
{
var pageNo = i / numberOfRowsPerPage + 1;
if
(!pagesDictionary.ContainsKey(pageNo))
{
pageSource = Activator.CreateInstance(dataSource.GetType())
as
IList;
pagesDictionary.Add(pageNo, pageSource);
var pageButton =
new
CommandBarToggleButton();
stripElementPages.Items.Add(pageButton);
pageButton.ToggleStateChanging +=
new
StateChangingEventHandler(pageButton_ToggleStateChanging);
pageButton.ToggleStateChanged +=
new
StateChangedEventHandler(pageButton_ToggleStateChanged);
pageButton.Text = pageNo.ToString();
pageButton.Tag = pageNo;
pageButton.Image =
null
;
pageButton.DrawText =
true
;
}
pageSource = pagesDictionary[pageNo]
as
IList;
pageSource.Add(list[i]);
}
lblNumPages.Text = pagesDictionary.Count.ToString();
radCommandBar1.Visible =
true
;
}
private
void
ClearPages()
{
var label = stripElementPages.Items.FirstOrDefault();
stripElementPages.Items.Clear();
if
(label !=
null
)
{
stripElementPages.Items.Add(label);
}
}
#endregion Methods
}
and the test form:
using
System;
using
System.Collections.Generic;
using
System.Drawing;
using
System.Windows.Forms;
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
this
.Size =
new
Size(640, 480);
}
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
LoadListDataSource();
}
private
void
LoadListDataSource()
{
var employees =
new
List<Employee>();
for
(
int
i = 0; i < 100; i++)
{
employees.Add(
new
Employee
{
Id = i,
Name =
"Employee "
+ i,
Email =
"Employee."
+ i +
"@something.com"
});
}
gridWithPagingControl1.GridView.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
gridWithPagingControl1.DataSource = employees;
}
}
public
class
Employee
{
public
int
Id
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
string
Email
{
get
;
set
;
}
}
If you have any problems just let me know, meanwhile i hope i'll have some time to clean up a few of the details and add this to the code library.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
Thank you for providing this sample of RadGridView paging functionality. Since it seems quite interesting, I think it is a good idea to make a Code Library article based on it. This will allow our users to find it easily.
Thank you for your cooperation.
All the best,
Stefan
the Telerik team
Could you perhaps upload the code here. It will just make it slightly easier than creating the usercontrol (ie commandbar with buttons etc).
Yip, I can be very lazy sometimes...
Jaco van Zyl
Our forums does not allow for attaching files. One should post a code library article if he/she wants to share his/her solution with the community.
All the best,
Nikolay
the Telerik team
Sorry again for the late reply but everything is crazy lately.
I have just submitted the project to the code library with a few enhancements, like support for sorting, filtering.
Please take a look at the attached images for more info.
As soon as the project will be approved i will post a link here.
On a sadder note (maybe), this version will only support IList data sources.
Please feel free to suggest other functionalities or other possible behaviors.
Best Regards,
Emanuel Varga
Telerik WinForms MVP
Thanks to Emanuel there is a sample application demonstrating this funcionality. It is available in our Code Library section at this link.
I hope you will find this useful.
Greetings,
Stefan
the Telerik team
So, did someone have any time to take a look at the grid with paging code project?
Best Regards,
Emanuel Varga
Telerik WinForms MVP
By just glancing at the code, it seems that the entire datasource is loaded and then all the paging etc is done, which I believe will cause the application to crawl if a significant amount of rows are loaded...and there is no need to load 1million rows to be able to use the filtering capabilities.
Instead, if you can handle the filtering manually (ie, no automatic filtering and handle events triggered before filtering is going to take place) and convert that telerik filter conditions into a equivalent SQL query, this can be handled very easily.
I don't know if the telerik controls have the ability to convert telerik grid filter conditions to SQL server queries, if not, you can probably create a recursive function to create a SQL query from the filter condition (assuming you have access to the filter conditions)...the ability for telerik to automatically convert it to a SQL query would be a plus.
Everything else can be handled by code very easily, as I have done that using another grid by another company and it works really well, as I only the top 500 rows and allow the user paginate through them. When the grid is filtered, a new query is created and the returned value is then bound to the grid....etc.
Just my 2c
Take Care
Thank you for your comments and suggestions. Currently, this functionality is not natively supported by RadGridView. The desired behavior can be achieved by using the custom filtering and converting FilterDescriptors collection to SQL query.
We will continue researching the possible implementation in Windows Forms context and binding. This feature will be included in one of the next major releases of RadControls for Winforms.
Julian Benkov
the Telerik team
Thank you for writing.
The number of votes for this feature increase its priority in our TO DO list. Feel free to vote for it here.
Svett
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
This feature is not implemented yet. In order to increase its priority, you can vote for it in at link that I have already provided in my previous post.
Kind regards,Svett
the Telerik team
http://www.telerik.com/support/pits.aspx#/public/winforms/4775
How come 5 years still does not provide the Paging, very very disappointed.
The paging is more suitable for web applications and it is not a common UI in desktop application. Moreover, this features is covered by a pretty well working Code Library article. Therefore, this feature is postponed in favor of other desired WinForms features that would be hard to be implemented outside the WinForms suite.
Kind regards,Svett
the Telerik team
The problem with the user supplied solution is that is needs objects that are ILists, and I only have DataTables. In addition, I imagine that filter boxes would only read from the visible values. (vs. all the values when creating the Excel like filtering options)
Rob.
I am sorry for the inconvenience caused.
As we mentioned paging is not a common for UI in desktop application. You can change our example to use a DataTable as follows:
private
void
LoadListDataSource()
{
var employees =
new
List<Employee>();
int
i = 0;
foreach
(DataRow dr
in
yourTable.Rows)
{
Employee emp =
new
Employee();
emp.Id = (
int
)dr[
"ID"
].ToString();
emp.Name =
"Employee "
+dr[
"Name"
].ToString();
employees.Add(emp);
++i;
}
You can refer to this StackOverflow article for more details about convert DataTable to List.
I hope this helps.
Kind regards,
Peter
the Telerik team
please, sorry for my English.
There is a bug with the Paging Example, when yo try to filtering data using the "Custom Filtering".
It shows a Exception Null Reference in class Main for the GridWithPaging example.
I want to know if there is a solution for this bug.
thank's
Alvaro.
Thank you for writing.
The provided information is not enough to determine what causes this. Could you, please, enable the exceptions in your Visual Studio (Debug -> Exceptions -> Managed Exceptions, check the checkbox) in order to debug where exactly the project crashes and let me know what is the result on your side?
Please, have in mind that the filtering is not supported in this mode and can be achieved by using the custom filtering but you should manually convert the FilterDescriptors collection to SQL query.
I hope this helps.
Regards,
Peter
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>