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

[Solved] Slow MVC Extensions Grid Rendering

0 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonathan
Top achievements
Rank 1
Jonathan asked on 09 Dec 2011, 04:28 PM
Im new to most of this, so I might be missing something,

I'm using mvc 2 c# .net 4.0 project with entity framework.

I wrote a view which contains a user control displaying a telerik mvc extensions grid. This grid uses one table with a lot of fields. Displaying works great.

On editing the grid rows I need a lot of the fields to be drop down lists.

To do this I need to annotate the fields in my table with uihint, this will use a editor template that is my dropdownlist.

In all, I have 13 data annotations for fields for my table object.

My problem is that after adding these annotations my grid renders extremely slowly.  Am I missing something?

Thanks for all the help!



My Data Annotations for my table object for Entity Framework
  [MetadataType(typeof(BlenderConfigMetadata))]
    public partial class blender_config
    {
    }
  
    public class BlenderConfigMetadata
    {
        [UIHint("Facility")]
        public object BC_FK_FC_ID { get; set; }
        [UIHint("Component")]
        public object BC_FK_CC_ID_H1 { get; set; }
  
//removed for brevity
}

DisplayTemplate - Facility
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="BlenderrWatcherv2.Models" %>
  
<%--<% if (Model != null)  %>
<%= @Html.Label(Lookup.GetSessionComponentName((long)Model, Session["ComponentNames"]).ToString()) %>
--%>

EditorTemplate - Facility
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="BlenderrWatcherv2.Models" %>
<%--
<% if (Model != null)  %>
<%= @Html.DropDownList("DDListSelectedComponent", Lookup.SetSelected(StaticModels.HopperList, (long)Model)) %>--%>

DisplayTemplate - Component
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="BlenderrWatcherv2.Models" %>
  
<%--<% if (Model != null)  %>
<%= @Html.Label(Lookup.GetSessionComponentName((long)Model, Session["ComponentNames"]).ToString()) %>
--%>

EditorTemplate - Component
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="BlenderrWatcherv2.Models" %>
<%--
<% if (Model != null)  %>
<%= @Html.DropDownList("DDListSelectedComponent", Lookup.SetSelected(StaticModels.HopperList, (long)Model)) %>--%>

View
<%= Html.Telerik().Grid(Model.BlenderConfigs)        
    .Name("BlenderGrid")
    .BindTo(Model.BlenderConfigs)
    .DataKeys(keys => keys.Add(bc => bc.BC_ID))
    .DataBinding(dataBinding => dataBinding.Server()
        .Select("ConfigureBlenders", "Admin")
        .Insert("InsertBlenderConfig", "Admin")
        .Update("SaveBlenderConfig", "Admin")
        .Delete("DeleteBlenderConfig", "Admin"))
          
    .Columns(columns =>        
    {
        columns.Command(commands =>
        {
            commands.Edit(); commands.Delete();
        }).Width(200);
          
          
        columns.Bound(bc => bc.BC_FK_FC_ID).Width(100).Title("Facility");
  
        columns.Bound(bc => bc.BC_FK_CC_ID_H1).Width(100).Title("1N");
        columns.Bound(bc => bc.BC_FK_CC_ID_H2).Width(100).Title("2N");
        columns.Bound(bc => bc.BC_FK_CC_ID_H3).Width(100).Title("3A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H4).Width(100).Title("4A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H5).Width(100).Title("5A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H6).Width(100).Title("6A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H7).Width(100).Title("7A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H8).Width(100).Title("8A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H9).Width(100).Title("9A");
        columns.Bound(bc => bc.BC_FK_CC_ID_H10).Width(100).Title("AA");
        columns.Bound(bc => bc.BC_FK_CC_ID_H11).Width(100).Title("BA");
        columns.Bound(bc => bc.BC_FK_CC_ID_H12).Width(100).Title("CA");
            
                      
    })
        .Editable(editing => editing.Mode(GridEditMode.InLine))
        .Pageable(paging =>             
            paging.PageSize(10)                  
            .Style(GridPagerStyles.Numeric)                  
            .Position(GridPagerPosition.Bottom))
        .Scrollable( scrollable => scrollable.Enabled(true))

Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Share this question
or