RadGrid can export its data to csv but default implementation doesnt fit terms of huge tables because it generates result export file in memory which doesnt work when you get like 5000k records.
I use RadGrid with LinqDataSource, and my tables contains millions of records. Im thinking on how to implement more smarty export. I have already had task subsystem running processes in threads etc, so what i really need is to get current RadGrid query with filters, sorting but without page limitation. This query i would put in my service which will «run» it and read record by record into file.
Does anybody know how to get current query, expression or whatever from RadGrid which would help to perfom the same query and read the data?
It seems that the single solution is to limit the number of the exported records:
Radgrid exporting large dataset
Related
We have developed Asp.net web application. and we are using asp.net gridview to display the records and edit.
here we have 5000 rows and 23 columns in single grid. it is taking long time for binding. our client refuse the pagination option. how to make the binding faster with 5000 to 7000 records.
Please Advise.
Thanks
Mayil.M
Where is your data come from? Is it database or other external resource?
You can use caching so you don't load the whole dataset from the external resource but from the memory. Please note this solution will not work if your data changes often.
Another approach would be to use some kind of partial loading mechanism using for example Ajax. This will however require changing approach as I am not sure the grid view control supports this. You would have to create custom control and then make sequential requests (using for example Ajax) for smaller chunks (eg. 200 records) of data and display them. Eventually you will have complete set but the data will be available faster.
Finally you can combine both, to make it even faster.
You should implement your own paging mechanism. The problem is that DataBind retrieves all 7000 records (although only i.e. 20 is displayed/rendered). Create for example a stored procedure that will fetch only selected range of records (if you are on Page 2 you need to display only record id > 20 and <= 40 - considering that your pagesize is 20). Use SQL server CTE to get the row number (on SQL Server side) and features like BETWEEN. This stored procedure would return only those records which you really need to. Then change your grid view to get the data from this stored procedure.
You can load data on scroll like facebook wall.
In My Database I Have 10000000 Records. In GridView First I Am Showing First 10 Records. In Order To See the Next Records User Need to Click Page Numbers ( 1,2,3,------10000). But As I'm Retrieving 10 Records for The First Time GridView Paging is not Showing.
Is There Any Way To Show Paging In ASP.NET GridView Statically ?
For so many records, I won't recommend Paging. You can show Top 20 recently added records and provide options to filter out records. A user can enter keywords. ReQuery and ReBind the GridView with this new result set.
You might also consider using PetaPoco, a Micro-ORM, which will help you fetch paged result.
With so many records, you really need to take into account the exact queries being run to pull back the data.
There are numerous ways of doing data paging ( http://beyondrelational.com/modules/2/blogs/28/posts/10434/sql-server-server-side-paging-with-rownumber-function.aspx ). However, the "best" way is dependent on the exact version of SQL Server you are running.
Essentially, the solutions boil down to you passing a page number and number of records per page through some type of query. Usually a stored procedure as the query can be quite messy.
Once there, you have an option. Either send the total record count back as an OUT parameter in your query and the result set back normally, or you send the total record count back as a column. There are definitely efficiency concerns with both options as one way requires the query to be run twice and the other requires an extra column of data which increases network traffic.
Once you have that solved then you can figure out exactly how you want the UI to work.
I have a database which has some table and every one of them has at least 100000 records.
I need to show reports of these data to admin of asp site so I have used views to join these table to get my required info to show. but the problem is when I run the page although it should show just 10 records for first page and other records can be lazy, it become time out because it takes so long time to make view and show in gridview.
Is there any way to handle this problem?
for example If I can make these joins for view when sql server is idle it will improve performance issue. But I don't know is it possible or not
hi how about using paging and loading data on request in gridview i mean here is an example hope this might help you:
Loading data on request and paging
I recommend you to use custom paging in you sql query
how does it work when i have a data grid that i want page able and sortable, do i use view state? does the data get pulled once and then the view state keeps all the data and grid working, sortable, page able?
or do i need to go to the db server each time i page and sort?
help clarify this point for me please.
If you use the built in paging without a SqlDataSource object, your data will be paged in memory, which can be a massive overhead.
ViewState will by default retain the information in the grid, however the data item for each row won't be available after a postback.
If you are dealing with large volumes of data, then paging and sorting should be done on the database so as littel data as possible is transferred to the web app.
My DAL is created using Linq and all is fine. However, on one page, I'm to display a table (gridview) which pulls data from a SQL Server database table. However, I've heard many warnings about staying away from using any of the built in controls (ObjectDataSource and SQLDataSource). Is there any truth in this, regarding scalability/efficiency? I posted a similar problem before but, in this case, I have direct access to the server. What would be the best way to bind the data to gridview? I can't cache the data as is it tailored to individuals and I'd rather not store them in sessions as there could be between 100-200 custom objects being called. I haven't really dabbled in SQL, but with a bit of reading, I'm sure I could create my own custom server side paging/filtering/sorting. Would it be efficient if I created a stored procedure for each of these functions and called them from an objectdatasource, or should I call the SP using Linq to SQL (in my DAL) and then display that information directly to the gridview?
Thanks for any advice
There is nothing wrong in using a grid view, or custom object data source, if it is only for some hundreds of records. Scalability is an issue for thousands of records. Fastest Access possible would be via a DataReader filling a Datatable. Binding gridviews to a Datatable is always a good idea for a large number of records, as binding is fast and sorting also.
I have therefore written a library called modelshredder that can translate any IEnumerable collection of objects into a DataTable. It uses dynamically emitted code to do its Job, that's why it's fast enough for thousands of records. You can use plain linq-to-sql to write and execute your query, prefetably project into an annonymous type and call .ToDataTable() on the result.