Passing data to the controller on refresh

4 posts, 0 answers
  1. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 13 Apr 2014 Link to this post

    I am trying to pass data to the controller using MVC wrappers. But data not being send, controller is executing but data is not passed. am I doing things correctly?
    Thanks

    var chart = $("#SalesChart").data("kendoChart");
    chart.refresh({
        data: { "FromDate": $("#FromDate").data("kendoDatePicker").value(), "ToDate": $("#ToDate").data("kendoDatePicker").value() }
    });

    @code
               Dim SalesChart As Kendo.Mvc.UI.Chart(Of BO.Models.Statistics.SalesTimeSpan) = _
                   Html.Kendo.Chart(Of BO.Models.Statistics.SalesTimeSpan).
                   Name("SalesChart").Title("Units sold").Series(Sub(series)
                                                                         series.Line(Function(model) model.Value, categoryExpression:=Function(model) model.Period).
                                                                         Aggregate(ChartSeriesAggregate.Avg)
                                                                 End Sub).
               CategoryAxis(Function(axis) axis.Date().BaseUnit(ChartAxisBaseUnit.Weeks)).
               DataSource(Function(ds) ds.Read(Function(read) read.Action("getsalesbydate", "statistics", New With {.area = String.Empty})))
     
               SalesChart.Render()
     
     
           End Code
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 16 Apr 2014 Link to this post

    Hi,

    The refresh method does not accept additional data as parameter. Your should use the chart dataSource read method instead to pass the values e.g.
    var chart = $("#SalesChart").data("kendoChart");
    chart.dataSource.read({
       "FromDate": $("#FromDate").data("kendoDatePicker").value(),
       "ToDate": $("#ToDate").data("kendoDatePicker").value()
    });


    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 16 Apr 2014 in reply to Daniel Link to this post

    Thanks that worked, I did try that, but I think I left the data: in,
    but still I have a problem, the dates from the datepicker are not binging to date objects on the controller. action.
    Thanks 
  5. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 17 Apr 2014 Link to this post

    Hi again,

    Could you share the code for the action method? Also, verify that you are using the same culture on the server and on the client. The client-side culture will be used by default to serialize the dates and numbers and the model binder will not parse the values if the culture is not the same.

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready