Telerik Forums
UI for ASP.NET MVC Forum
0 answers
291 views

Hello, friends, I have a problem. Please help me. I have a table with a data volume of about 5 million. When I use IQueryable.ToDataSourceResult(request), it will take a lot of time. So I changed IQueryable.ToDataSourceResult(request) to IQueryable.ToDataSourceResultAsync(request), but it will be very slow when I want to get the Result.Data. Do you have a good solution, thank you.

 

 

 

盼宇
Top achievements
Rank 1
Iron
 asked on 12 Aug 2022
0 answers
171 views

Team 

we are facing the issue binding the data into kendo.mvc.UI grid

here is the screenshots

my UI source code:

@(Html.Kendo().Grid<ClientOnboarding.Data.EF_COB_PortalUsr>()
    .Name("CompanyDemographGrid")
    .Selectable()
    .Columns(columns =>
    {
        columns.Bound(c => c.name).Width(110);
        columns.Bound(c => c.email).Width(110);
        columns.Command(command =>
        {
            command.Edit();
            command.Destroy();
        }).Width(120);

    })
    .DataSource(dataSource => dataSource
      .Ajax()
      .PageSize(5)
      .Events(events => events.Error("error_handler"))
    .Model(model =>
    {
        model.Id(mdel => mdel.Rec_id);
        model.Field(mdel => mdel.Rec_id).Editable(false);
        model.Id(mdl => mdl.name);
        model.Field(mdl => mdl.name).Editable(false);
        model.Id(mdl => mdl.email);
        model.Field(mdl => mdl.email).Editable(false);
    }
    )
    .Read(read => read.Action("BindAllDemographPortlUsr", "OnBoarding"))
  .Update(update => update.Action("UpdateDemographPortlUsr", "OnBoarding"))
  .Create(update => update.Action("AddDemographPortlUsr", "Grid"))
  .Destroy(destroy => destroy.Action("DeleteDemographPortlUsr", "OnBoarding"))

    )
.ToolBar(toolbar => toolbar.Create())



   // Set grid editable.
   .Editable(editable => editable.Mode(GridEditMode.InCell))

    // Set grid sortable.
    .Sortable()

    // Set grid selectable.
    .Selectable()

    // Set grid pagable.
    .Pageable(pageable =>
    {
        pageable.Refresh(true);
        pageable.PageSizes(true);


    })
                                )

      note: please suggests  where i did mistake   

 

 

guru
Top achievements
Rank 1
 asked on 11 Aug 2022
1 answer
136 views

This is my code:

Index.cshtml

@model IEnumerable<ManagePartsViewModel> @(Html.Kendo().Grid(Model) .Name("grid-parts") .Columns(columns => { columns.Bound(f => f.Identifier).Hidden(); columns.Bound(f => f.PartType); columns.Bound(f => f.PartNumber); columns.Bound(f => f.PartName); columns.Bound(f => f.Barcode); columns.Bound(f => f.Warehouse); columns.Bound(f => f.Quantity); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(p => p.Identifier); model.Field(p => p.PartType); model.Field(p => p.PartNumber); model.Field(p => p.PartName); model.Field(p => p.Barcode); model.Field(p => p.Warehouse); model.Field(p => p.Quantity); }) .Aggregates(aggregates => { aggregates.Add(p => p.PartType).Count(); }) .Group(groups => { groups.Add(p => p.PartType); }) .PageSize(8) .ServerOperation(false) ) .Groupable() .Pageable() .NoRecords() .Deferred() )

@section scripts
{
@Html.Kendo().DeferredScripts()
}

ManagePartsViewModel.cs

public class ManagePartsViewModel
{
    public int Identifier { get; set; }
    public string PartType { get; set; }
    public string PartNumber { get; set; }
    public string PartName { get; set; }
    public string Barcode { get; set; }
    public string Warehouse { get; set; }
    public int Quantity { get; set; }
}

HomeController.cs

public class HomeController : Controller
{
    private readonly IPartsService _partsService;
    private readonly ILogger<HomeController> _logger;

    public HomeController(IPartsService partsService, ILogger<HomeController> logger)
    {
        _partsService = partsService;
        _logger = logger;
    }

    public async Task<ActionResult<IEnumerable<ManagePartsViewModel>>> Index(IEnumerable<ManagePartsViewModel> viewModel)
    {
        try
        {
            viewModel = await _partsService.GetParts();
            return View(viewModel);
        }
        catch (Exception ex)
        {
            _logger.LogCritical(ex, ex.Message);
            return BadRequest();
        }
    }
}

Throws me this exception:

An unhandled exception occurred while processing the request.

ArgumentException: Invalid property or field - 'PartType' for type: AggregateFunctionsGroup
Yanislav
Telerik team
 answered on 10 Aug 2022
1 answer
498 views

Net MVC application there I want to update the telerik control as per the security team.

I am looking at the nuget packages and it giving me multiple options. The MVC projects that I have it is running on .net 4.7.2 so I am not sure which package to install. Also I used to think MVC4 is .net 4x.x but seem like it is not true so here is the Here are the multiple options for MVC:

Telerik.Ui.For.ASPNet>MVC3

Telerik.Ui.For.ASPNet>MVC4

Telerik.Ui.For.ASPNet>MVC5

Telerik.Ui.For.ASPNet.Core

I thought Telerik.Ui.For.ASPNet>MVC4 would work on 4.7.2 but it is not working as expected when I installed the several different packages.

Another confusion created to me by Telerik documentation. If it is referring to 3, 4 or 5 what does it really means?

" Telerik.UI.for.AspNet.Core—Telerik UI for ASP.NET Core Commercial.

Telerik.UI.for.AspNet.Mvc5—Telerik UI for ASP.NET MVC 5 Commercial.

Telerik.UI.for.AspNet.Mvc4—Telerik UI for ASP.NET MVC 4 Commercial.

Telerik.UI.for.AspNet.Mvc3—Telerik UI for ASP.NET MVC 3 Commercial.

Anton Mironov
Telerik team
 answered on 09 Aug 2022
1 answer
821 views


I am using asp.net Mvc app 4.7.2 .net version. If I get the nuget package, how can I check which Jquery version it is supporting?  

I have Jquery installed separately 3.6.0.  in my mvc project.

Yanislav
Telerik team
 answered on 09 Aug 2022
0 answers
105 views

Hello everyone, when I use grid to display data, the data is displayed normally when I use one grouping condition, but when I use multiple grouping conditions, an error will be reported. The database I use is mysql, and the error is when I call the todatasourceresult method

This is one grouping condition

This is two grouping condition

Here is my code and error information

Thank you all

 

 

 

盼宇
Top achievements
Rank 1
Iron
 asked on 05 Aug 2022
0 answers
138 views

 

In Main View

==========

columns.Bound(p => p.HuomName).Width(50).ClientTemplate("#=HuomName#").Title("H.UOM").Filterable(false).EditorTemplateName("HuomTemplate");

 

In Editor Template View

=====================

@(Html.Kendo().ComboBoxFor(m => m)
                      .Placeholder("Select H.UOM")
                      .DataValueField("uomID")
                      .DataTextField("HuomName")
                       .HtmlAttributes(new { @class = "form-control", @tabindex = "6" })
                      .DataSource(source => {
                          source.Read(read =>
                          {
                              read.Action("getGridH_UOM", "Order").Data("hUomFilter");
                          }).ServerFiltering(true);
                      })
                      .Events(e =>
                      {
                          e.Change("on_H_uom_grid_Change");
                      })
                )
Ecosoft
Top achievements
Rank 1
 asked on 03 Aug 2022
1 answer
112 views

Summary

As of Telerik v2022, after loading a persist state in a Grid, the HTML tags change from <a> to <span>. 

When we updated to Telerk 2022, we noticed that after loading a persisted state grid, the format of column heading changed. This led us to investigate the HTML tags before and after loading persist states and note that the HTML tags changed. This was true even on the Grid Persist State example in Telerik Docs: https://demos.telerik.com/aspnet-mvc/grid/persist-state.

Before Loading State

This is after loading the page and before interacting with the grid at all. (ie: Pressing F5)


<tr>
	<th class="k-header k-filterable" data-field="ContactName" data-index="0" data-title="Contact Name" id="322f9873-a501-4984-9596-11746efc9cbe" scope="col" data-role="columnsorter" style="touch-action: none;">
		<a class="k-link" href="/aspnet-mvc/grid/persiststate_customers_read?grid-sort=ContactName-asc">Contact Name</a>
		<a class="k-header-column-menu" href="#" title="Contact Name edit column settings" aria-label="Contact Name edit column settings" tabindex="-1">
			<span class="k-icon k-i-more-vertical"></span>
		</a>
	</th>
</tr>


After Loading State

This is after loading the persisted state of the grid. (ie: Clicking the "Load State") This behaviour is the same regardless if you save the state before. After clicking "Load State" without editing anything (in order to keep HTML as close as possible) this is the HTML.


<tr>
	<th scope="col" role="columnheader" data-field="ContactName" aria-haspopup="true" rowspan="1" data-title="Contact Name" aria-label="Contact Name Press ctrl + space to group" data-index="0" headers="undefined" id="65f2198b-846f-464a-9cb2-c04152d624eb" class="k-header k-filterable" data-role="columnsorter" style="touch-action: none;">
		<span class="k-cell-inner">
		<span class="k-link">
			<span class="k-column-title">Contact Name</span>
		</span>
		<a class="k-header-column-menu" href="#" title="Contact Name edit column settings" aria-label="Contact Name edit column settings" tabindex="-1">
			<span class="k-icon k-i-more-vertical"></span>
		</a>
		</span>
	</th>
</tr>

 

Differences

When initially loading, the "k-link" class is initially in an <a> tag, however, after loading persist state, it is in a <span> tag. Since our CSS file was tied to the type of the HTML tag, this broke our formatting functionality. Is this behaviour intentional? Especially as this can cause formatting, JS tied behaviour and other issues with sites that transition to use a Telerik 2022 Persist State Grid.

 

Ivan Danchev
Telerik team
 answered on 03 Aug 2022
0 answers
347 views

Hi,

I have a kendo grid for MVC and bound columns. I have to format date in one of columns as specified above.(QQ-YYYY)(Quarter Of the year format.) I tried below for followup date, but doesnt work. Please let me know solution that works other than this

 

@(Html.Kendo().Grid(Model) .Name("grid") .Columns(columns => { columns.Bound(p => p.TeamRank).Title("Team Rank").Hidden(); columns.Bound(p => p.ETA).Title("Forecast").ClientTemplate("#=formatDate(ETA)#"); }

function formatDate(ETA) {
    var CurrentQuarter = ((ETA.getMonth - 1) / 3) + 1;
    return CurrentQuarter + "-" + ETA.getFullYear;
}
Sunitha
Top achievements
Rank 1
 asked on 02 Aug 2022
4 answers
4.0K+ views
Hi,

I have a view with telerik asp.net mvc button on it. When the user clicks on this button, I would like to redirect to another view. I looked into the control documentation but could not find anything in the Events section. Please help me.
Below is my button code for reference.

<div style="text-align:right">
    @(Html.Kendo().Button()
    .Name("add")
    .Content("Add Project")
    .HtmlAttributes(new { type = "button" })
    .Events(e => e.Click("GoToCreateView")))
</div>

Thanks.
Hamish
Top achievements
Rank 1
Iron
 updated answer on 02 Aug 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?