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

RadGrid load all data before paging

3 Answers 375 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tomaž Lovrec
Top achievements
Rank 1
Tomaž Lovrec asked on 25 Jan 2010, 10:34 AM
Hello,

currently I have ~300 rows and over 21 columns of data.(Both of those will rise over time) And I'm also implementing paging. It takes a long time to switch between pages, because RadGrid is accessing the Database each time I switch a page, is it possible to load all the data into the RadGrid, for all pages, so when I would change pages it would just show those from cache or somewhere and reduce the time taking between those page changes?

Thanks in advance and regards,
Thomas

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 25 Jan 2010, 11:29 AM
Hello Tomaž,

Attached to this message is a simple runnable application which handles the desired functionality. Please give it a try and let me know if it works as expected.

I hope this helps.

All the best,
Pavlina
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
Tomaž Lovrec
Top achievements
Rank 1
answered on 25 Jan 2010, 11:39 AM
Hello Pavlina!

Thanks for your reply, I haven't checked the code yet, got pulled away from my work and I'm continuing with something else, but judging by the title of the attached file, the data from the DB gets saved to the session and after changing the page, it will still re-render the RadGrid. Correct me if I'm wrong.
I know I haven't described the issue as I should but I'm looking for a more show and hide solution to certain items. It could be that I'm also trying to solve the problem from the wrong side.

So, to begin at the beginning, where my problems start. :)
This is a dinamic RadGrid, only 3 columns(includin ID column) are static, all the others are programatically added inside Page_Init, like so:
protected void Page_Init(object sender, EventArgs e) 
    { 
        bool? boolean = true
        var seminarji = from s in db.Appointments 
                        join d in db.AppointmentTypes on s.id_app_type equals d.id 
                        where s.start.Year == leto && s.id_app_type == 1 || 
                        s.start.Year == leto && s.id_app_type == 2 || 
                        s.start.Year == leto && s.id_app_type == 3 || 
                        s.start.Year == leto && s.id_app_type == 4 
                        select new 
                        { 
                            s.id, 
                            seminar = s.start.Day.ToString() + '.' + s.start.Month.ToString() + '.' + s.start.Year.ToString() + ' ' + 
                                d.name.ToString() + ' ' + d.type.ToString() 
                        }; 
 
        foreach (var seminar in seminarji) 
        { 
            GridTemplateColumn column = new GridTemplateColumn(); 
            column.UniqueName = seminar.id.ToString(); 
            column.DataField = seminar.id.ToString(); 
            column.HeaderText = seminar.seminar.ToString(); 
            column.SortExpression = seminar.id.ToString(); 
            column.DataType = boolean.GetType(); 
            column.AllowFiltering = false
            column.ItemTemplate = new myTemplate(seminar.id.ToString()); 
            RadGrid1.MasterTableView.Columns.Add(column); 
        } 
    } 

The ITemplate is a simple CheckBox.
And everytime I switch pages, a few more empty columns are created, don't know from where, but not from this code, because I've tried debugging and going through step by step. I hope you understand what I mean, I can also supply a screenshot of the page if need so.
So, here is my main problem, beside that long waiting periods between pages.

Hope we can find a solution. :)

Thanks again and kidn regards,
Thomas
0
Pavlina
Telerik team
answered on 26 Jan 2010, 05:26 PM
Hi Tomaž,

Please, note that RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file.

For more information you can review this help article:
http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html

Sincerely yours,
Pavlina
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
Tomaž Lovrec
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Tomaž Lovrec
Top achievements
Rank 1
Share this question
or