Telerik Forums
UI for ASP.NET MVC Forum
1 answer
1.3K+ views
Hi,

I've read several posts (stackoverflow, kendo forums, ...), but I don't find a 100% effective solution for my scenario. My team is facing a performance problem with our current code to filter/sort/group/... records in the Kendo Grid, this is a simple example of one of our possible flows:

MVC Controller Action:
[HttpPost]
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
    // userService uses a client to call WebAPI action
    var usersList = this.userService.UsersList;
      
    var dataSource = usersList.ToDataSourceResult(request);
    return this.Json(dataSource, JsonRequestBehavior.AllowGet);
}
Client Action:
public UserResponseDto Users()
{
    var requestUri = this.ApiRequestUri("/User/User/Get/");
    var response = this.GetAs<UserResponseDto>(requestUri);
    return response;
}
WebAPI Controller Action:
[HttpGet]
public UserResponseDto Get()
{
    var result = this.userService.GetUsers(null);
    var response = new UserResponseDto { Users = result };
    return response;
}
The Repository:
public IEnumerable<UserDto> Users(UserRequestDto userRequestDto)
{
    // calls an store procedure and retrieves data as DTO
    var parameters = new[]
           {
          SqlHelper.BuildParameter(SqlDbType.VarChar, "@sUserId", ParameterDirection.Input, userRequestDto.UserId)
   };
  
    using (var sqlAccess = this.sqlAccessFactory.Invoke(//some parameters))
    {
        var collectionPocos =
            sqlAccess.ExecProcedureEntity<UserPoco>(
                "SVC_GetUser", parameters.ToArray(), true);
  
        return
            collectionPocos.Select(
                sp =>
                new UserDto
                {
                    // Fill the properties
                });
    }
}

As you can see we’re getting all the records from API and then we use this Kendo function “ToDataSourceResult” that makes all the logic and show just required records in the grid. 

The problem is that there are some cases where the data set has (bi)millions of records, fetching all of the rows is a very expensive process, so we're trying to do the filtering, sorting, grouping,.. in the stored procedure to reduce the amount of data per request. As a team we discussed of possible solutions:
  • Create a functionality to get from the Kendo DataSourceRequest object (filters, sorting, page,…) and dynamically build the request and send them to the WebAPI. 
  • Build the where clause based on the filters that we have and send it as parameter to the SP, like in this post.
  • Use OData (according this article Kendo UI MVC Wrappers doesnt support OData)
Does anybody could provide me some guidance if this is a known issue, if there is a workaround or solution?

Some extra information of our System:
  • It's a N-Tier application
  • MVC is used for the front-end tier
  • All the Data Base calls must be done using Stored Procedures
  • The WebAPI is the one that calls the stored procedures
  • In future all the tiers will be placed in different servers, probably with different firewall configurations (so, the idea is to minimize the size of data that travels between them)
  • Application uses the Kendo UI MVC Wrappers 
  • There's a custom solution to apply our metadata in the Kendo Wrapper, so instead of this code
@(
    Html.Kendo().Grid<User>()
        .Name("UsersList")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Read", "User"))
        )
        .Scrollable(s => s.Virtual(true).Enabled(true))
)
we have this:
@(
    Html.Flex().GridFor(m => m.UsersList, "Id", "Read", "User")
)

Some links:

http://stackoverflow.com/questions/15843703/kendo-mvc-todatasourceresult-extremly-slow-with-large-iqueryable
http://www.kendoui.com/forums/kendo-ui-web/grid/handle-filter-generated-parameters-on-server-side-for-a-grid-serverfiltering-true.aspx
http://stackoverflow.com/questions/13738249/get-paging-filtering-from-telerik-extension-grid-and-pass-to-stored-procedure
http://www.telerik.com/community/forums/aspnet-mvc/grid/best-approach-for-large-amounts-of-data.aspx
http://blogs.msdn.com/b/webdev/archive/2013/02/25/translating-odata-queries-to-hql.aspx


Thanks in advance,
Petur Subev
Telerik team
 answered on 27 Nov 2013
1 answer
101 views
Hi,

This is probably a very easy answer but after the update to 2013.3.1119 the menu is rendering a horizontal and vertical scroll bar on each child menu item and the width of the child menu is locked to the top menu item. All the top menu items looks fine. If the child menu has an inner child menu item the menu also rendered correctly. We are stuck on IE8 at the moment. Any ideas how this can be corrected?

Rob 
Dimo
Telerik team
 answered on 27 Nov 2013
5 answers
722 views
Hi!

I am trying to start a kendo mvc project with VS extension. However, when I use the wizard, it fails and I get this error:

An error occured while running the wizard.

Error executing custom action Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction: System.IO.FileLoadException: Could not load file or assembly 'Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The keyset is not defined. (Exception from HRESULT: 0x80090019)
File name: 'Kendo.Mvc, Version=2013.2.716.340, Culture=neutral, PublicKeyToken=121fae78165ba3d4' ---> System.Runtime.InteropServices.COMException (0x80090019): The keyset is not defined. (Exception from HRESULT: 0x80090019)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.GetKendoVersionedFolder(String mainAssemblyLoadInfo)
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.ModifyResources()
   at Telerik.KendoUI.Mvc.VSX.Actions.CopyResourcesAction.Execute(WizardContext wizardContext, IPropertyDataDictionary arguments, IProjectWrap project)
   at Telerik.VSX.Actions.ProjectActionBase.Execute(WizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.Actions.ActionBase.Telerik.WizardFramework.IAction.Execute(IWizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.ActionManager.ExecActions()

Does anyone know what it is happening?

Thanks!
Rick Hubka
Top achievements
Rank 1
 answered on 26 Nov 2013
5 answers
1.5K+ views
I've got a view with a kendo grid on it.  Above that I have a partial view that loads a value and stores it in a hidden.  I need to be able to pass the value of this hidden field to the get, add, update, and delete methods of the grid preferably without having to load the grid via jquery (if possible).

Or is there a way that the hidden field on the view could be accessible or passed to the editortemplate for the grid so that I can make it part of the view model when a row is added or updated?

Here is the main view:
@model IEnumerable<PASSAdmin.ViewModels.UserFacilityAdmin.ProposalTypeViewModel>
 
@{
    ViewBag.Title = "Proposal Types";
}
 
<h2>Proposal Types</h2>
 
@Html.Partial("_LastViewedUserFacility")
 
@{    
    Html.Kendo().Grid(Model)
    .Name("gridProposalTypes")
    .Columns(columns =>
    {
        columns.Command(command => { command.Edit(); }).Width(50);
        columns.Bound(o => o.Code);
        columns.Bound(o => o.Description);
        columns.Bound(o => o.Technique_Selection_Count).Title("# Techniques");
        columns.Bound(o => o.Resource_Selection_Count).Title("# Resources");
        columns.Bound(o => o.Selection_Order).Title("Selection Order");       
        columns.Bound(o => o.Active);
        columns.Command(command => { command.Destroy(); }).Width(50);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UserFacilityAdmin/ProposalType").Window(window => window.Width(400)))
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Server()
        .Model(model => model.Id(o => o.ID))
        .Create(create => create.Action("AddProposalType", "UserFacilityAdmin"))
        .Read(read => read.Action("ProposalTypes", "UserFacilityAdmin"))
        .Update(update => update.Action("UpdateProposalType", "UserFacilityAdmin"))
        .Destroy(destroy => destroy.Action("DeleteProposalType", "UserFacilityAdmin"))
    )
    .Render();
}
Here is the partial view loaded above the grid:
<p>User Facility: <span id="userfacility"></span></p>
 
<input type="hidden" name="User_Facility_ID" id="User_Facility_ID" />
 
<script type="text/javascript">
$(document).ready(function () {
    $.post('/Search/GetLastViewedUserFacilityID', function (data) {
        $("#userfacility").html(data);
        $("#User_Facility_ID").val(data);
    });
});
</script>
The "User_Facility_ID" is the value I need when doing the get, add, update, and delete for the grid.





Petur Subev
Telerik team
 answered on 26 Nov 2013
3 answers
198 views
On a ASP.NET MVC UI, I need to expose multiple input controls (list, multiselect, date controls) on the top and a grid in the bottom.
The grid will be filtered based upon the values selected (with list selection resulting in OR condition, multi-select selections resulting in AND condition and so on) and with their own column filters
I am currently writing a Big ViewModel which will have a collection of the list, multi-select items and then a collection to support grid rows which change according to the filters above.
On a submit button, all the filters (from the list/multiselect controls + the grid column filters) should all filter the grid rows at once.
All my UI widgets are Kendo UI widgets. I am using the MVC wrapper.
Question is : Where do I store the selections the user makes ? I don't want to use any comma-separated logic. I want the VM to be filled with actual selections on post so that I apply the filters on the grid and return the JSONresult?

I am just not able to get the ViewModel and view synced properly.
Vladimir Iliev
Telerik team
 answered on 26 Nov 2013
2 answers
62 views
I want to implement a custom routine that is triggered by a button on a pop-up editor, from a grid.

The routine needs to be passed values that the user has entered into the form (but before the form has been submitted) .  How can I obtain these values from a function called from a buttons onclick handler?

I know that its possible to reference controls from the grids edit event, using the e.container object, but how do I do this outside of the edit event?

e.g:-  I have a text box defined:-
<p>  <span class="fieldlabel2">
           Target Table:
        </span>
 
            @Html.TextBoxFor(c => c.TargetTable, new { style = "width:200px", Maxlength = 50 })
            @Html.ValidationMessageFor(c => c.TargetTable)
          
</p>
How can I get the value typed into this from a function (not the edit event handler)?
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 26 Nov 2013
1 answer
95 views
I am doing drag and drop from one listview to another and everything is working great except on a tablet - the drop point seems to not work correctly (wrong x,y coordinates?)

I am not using the Kendo mobile listview - it's a std kendo mvc listview.

On desktops - the drop is great.

Any info on this?

Thanks,

Rene.
Nikolay Rusev
Telerik team
 answered on 26 Nov 2013
3 answers
400 views
I built a multi-level vertical menus on a menu partial view.
@using Kendo.Mvc.UI.Fluent
@using MyModels;
 
@functions{
    public void addChildren(MenuItemBuilder builder, AppMainMenu item, IEnumerable<MyMenuStructure> items)
    {      
        var children = items.Where(m => m.ParentMenuID == item.MenuID);
        if (children != null)
        {
            builder.Items(menuItems =>
                {
                    foreach (var child in children)
                    {
                        var menuItem = menuItems.Add().Text(child.Name);
                        menuItem.Action(child.Action, child.Controller);
                        }
                        addChildren(menuItem, child, items);
                    }
                }
            );
        }
    }
}
  
@(Html.Kendo().Menu()
    .Name("menu")
    .Items(menu => {
        using (PCSContext pcscontext = new PCSContext())
        {
             var menus = got my menu structures;
            foreach (var item in menus.Where(m=> m.ParentMenuID == null))
            {
                var builder = menu.Add().Text(item.Name);
                builder.Action(item.Action, item.ControllerName);
                addChildren(builder, item, menus);
            }
        }
    }
    )
)
On my layou view I set it like this:
Html.Partial("~/Views/Shared/_MyMenu.cshtml");
<script>
                        $("#menu").kendoMenu({
                            animation: { open: { effects: "fadeIn" } },
                            orientation: "vertical",
                            direction: "left"
                        });
                    </script>

I got the below errors:

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'kendoMenu' at the line of:
<ul class="k-widget k-reset k-header k-menu" id="menu"><li class="k-item k-state-highlight k-state-default"><a class="k-link" href...">Home</a></li><li class="k-item k-state-default"><span class="k-link">My Account</span></li><li class="k-item k-state-default"><span class="k-link">Admin<span class="k-icon k-i-arrow-s"></span></span><ul class="k-group"><li class="k-item k-state-default"><a class="k-link" href...">User Management</a></li></ul></li><li class="k-item k-state-default"><a class="k-link" href="...">About</a></li></ul><script>
jQuery(function(){jQuery("#menu").kendoMenu({});});
</script>

I have include the scripts in my layout:
<script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
 @Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/kendo")
@Scripts.Render("~/bundles/kendo")
I created those bundles in bundle configuration. What do I miss then?

And my menus look weird(see the attached file) after choosing "continue" after the above error(I'm using MVC4 and latest kendo complete for ASP.NET MVC).
1. Two look greyed out and two look enabled, but if click it does take you to the destination.
2. The popup submenu has a space between popup and the parent menu.
3. The menu is in an splitter pane. After collapse the pane and re-expand it, the popup doesn't show. You can see there appears a horizontal scrollbar instead in the pane.

How can I make all the menus look "not greyed"? How to get rid of the space? How to keep same after re-expand after collapse the splitter pane? I also don't like the little white rectangle and dark-grey rectangle shown on the screen at the corner of the menu item. How to make it look like the kendo demo?

I have tried couple of days trying to solve the above issues, but it didn't work.

Thanks.
Daniel
Telerik team
 answered on 25 Nov 2013
1 answer
147 views
Hi, 
I am just getting started with Kendo UI and am having trouble getting the Inline-Editing of a Grid to render properly when using the Html Helper (Html.Kendo().Grid<>()). Kendo seems to interfere with the default MVC 4 and MVC 5 styles even when I have a fresh "Kendo UI C#" project created right out of the box.

I am tempted to give up on the Html Helpers all together and use the JS only route using Json calls for every data load etc, but it seems I would have to do quite a bit more work.

I have attached a screenshot that shows the styling issues I mean. For instance all textboxes are 300px wide (which I believe is the MVC template default). How have you worked around this?

@(Html.Kendo().Grid<KendoUIMvcApplication1.Models.MyEntity>(Model)
    .Name("DefaultGrid").Editable()
    .Columns( columns =>
        {
            columns.AutoGenerate(true);
            columns.Command(command =>
            {
                command.Edit();
            });
        })
    .DataSource(dataSource => dataSource
        .Server()
        .Model(model => model.Id(p => p.Id))
        .Create("Create", "Home")
        .Update("Update", "Home")
        .Destroy("Delete", "Home"))
    );


Thanks,
Matt
Petur Subev
Telerik team
 answered on 25 Nov 2013
1 answer
538 views
Hi!

I'm trying to make a scheduler read-only by setting scheduler.options.editable = false. This prevents users from creating new events, from double-clicking to get the editor, and from resizing events. However, they are still able to MOVE events. 

How can I disable that as well, and thus make the scheduler truly read-only?

Best regards,
  Gunnar Sylthe

Rosen
Telerik team
 answered on 25 Nov 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?