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

Grid doesn't call read method on loading

5 Answers 1303 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ruslan
Top achievements
Rank 1
Ruslan asked on 26 Aug 2015, 01:04 PM

Grid doesn't call read method after page loading. It calls it if I press on Refresh button only. What's wrong in grid configuration?

Code in .cshtml file:

@(Html.Kendo().Grid<GatherFormModel>()
      .Name("gridGatherForm")
      .AutoBind(false)
      .Columns(
          c =>
          {
              c.Bound(m => m.Id).Hidden(true);
              c.Bound(m => m.Order).Title("№");
              c.Bound(m => m.DepartmentName);
              c.Bound(m => m.Name).Title("Name");
              c.Bound(m => m.PeriodicityName).Title("Periodicity");
              c.Bound(m => m.StateName).Title("State");
              c.Bound(m => m.PeriodName).Title("Data range");
              c.Bound(m => m.IsStarted).Title("");
          })
      .Pageable(p => p.Enabled(true).Refresh(true))
      .Editable(p => p.Enabled(false))
      .Groupable(g => g.Enabled(false))
      .DataSource(d => d.Ajax()
          .PageSize(30)
          .ServerOperation(true)
          .Read(read => read.Url(Url.Action("Get", "GatherForm", new {httproute = ""})))
      ))

5 Answers, 1 is accepted

Sort by
0
Ruslan
Top achievements
Rank 1
answered on 26 Aug 2015, 01:33 PM
I solved this issue. I notice that Kendo doesn't find resources on initialization stage (sprite.png, for example). I put it to the expected path and everything is ok now.
0
Boyan Dimitrov
Telerik team
answered on 28 Aug 2015, 07:45 AM

Hello Ruslan,

The reason why the DataSource does not call its read method is because the autoBind option for the Kendo UI Grid is disabled. 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
jinu
Top achievements
Rank 1
answered on 13 Jun 2018, 05:25 AM

Can somebody help?

kendo action is not getting called.

@model IEnumerable<WebApplication1.Models.Employee.Employee>

@*<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.dataviz.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.dataviz.default.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.mobile.all.min.css">*@

<script src="http://code.jquery.com/Jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/ui/1.8.20/jquery-ui.min.js" type="text/javascript"></script>
<script src="~/scripts/kendo/kendo.all.min.js" type="text/javascript"></script>
<script src="~/scripts/kendo/kendo.web.min.js" type="text/javascript"></script>
<script src="~/scripts/kendo/kendo.aspnetmvc.min.js" type="text/javascript"></script>
@*<link href="~/Content/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo.default.min.css" rel="stylesheet" type="text/css" />*@
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.common.min.css">
@*<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.rtl.min.css">*@
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1119/styles/kendo.default.min.css">

<script src="~/scripts/kendo/kendo.web.min.js"></script>






    @(Html.Kendo().Grid<WebApplication1.Models.EmployeeviewModel>()
        .Name("employeelist")
        .AutoBind(true)
        .Columns(columns =>
        {
            columns.Bound(c => c.empid);
            columns.Bound(p => p.empname).Width(150);

        })

.DataSource(source=>source
.Ajax()
.PageSize(5)
.Read(read=>read.Action("Read","Employee"))
)
        
    )

 

 

 

 

 

 

 

controller

[HttpGet]
        public ActionResult Read()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Read([DataSourceRequest]DataSourceRequest request)
        {
            IQueryable<Employee> emp = db.Employees;
            DataSourceResult result=emp.ToDataSourceResult(request,e=>new EmployeeviewModel
                {
                empid=Convert.ToString(e.Emp_id),
                empname=e.Emp_name

                
            });
            return Json(result);        }

    }

 

 

 

 

0
Boyan Dimitrov
Telerik team
answered on 14 Jun 2018, 01:38 PM
Hello,

The reason for this behavior is because the kendo.web.min.js is loaded after the aspnetmvc.min.js script. I also noticed that there are some duplicated scripts files loaded in the page. For example there is no need to add the kendo.web.min.js two times and the kendo.all.min.js scripts. You can simply add the kendo.all.min.js and after that the kendo.aspnetmvc.min.js script. 

Regards,
Boyan Dimitrov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
answered on 24 Mar 2020, 12:32 PM
Thank you. It is working for me now.
Tags
Grid
Asked by
Ruslan
Top achievements
Rank 1
Answers by
Ruslan
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
jinu
Top achievements
Rank 1
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
Share this question
or