Telerik Forums
UI for ASP.NET MVC Forum
1 answer
147 views

I am using the scheduler binding to local data from my viewmodel.  The scheduler is set to TimeZone of "Etc/UTC" and all the dates are stored as UTC however they are all adjusted in the scheduler. How can I turn off scheduler timezone adjustments. There  should be nothing to adjust to since everything is UTC!

Honestly, I keep running into problem after problem with these products and I think that $2,000 was a big mistake.

Andrew
Top achievements
Rank 1
 answered on 13 Sep 2015
1 answer
1.9K+ views

The problem is I'm not able to pass the date selected by user from Kendo Date time picker in View to Controller using ajax call. Any help or input would be much appreciated. When I put the debugger, I found that control is just passing over it but not hitting the  Action method in the Home controller.

 

View

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

<div class="chart-wrapper">
    @(Html.Kendo().Chart()
        .Name("chart")
        .Title("Power Output")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Bottom)
        )
        .ChartArea(chartArea => chartArea
            .Background("transparent")
        )
        .SeriesDefaults(seriesDefaults =>
            seriesDefaults.Area().Line(line => line.Style(ChartAreaStyle.Smooth))
        )
        .Series(series =>
        {
            series.Area(ViewBag.Value).Name("Power");
        })
        .CategoryAxis(axis => axis
            .Date()
            .Categories(ViewBag.TimeStamp)
        )
        .ValueAxis(axis => axis
            .Numeric()
            .Labels(labels => labels.Format("{0}"))
            .AxisCrossingValue(-10)
            .Line(line => line.Visible(false))
        )
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Format("{0}%")
            .Template("#= series.name #: #= value #")
        )
    )
    </div>
<div>
    <h4>Select Date</h4>
    <input id="datepicker"/>
    <script>
        $(document).ready(function() {
            function onChange() {
                debugger;
                var date = kendo.toString(this.value());
                $.post('/Home/Index', { "date": date }, function () {
                    alert("data is posted successfully");
                    window.location.reload(true);
                });
                //this.close();
            }
            $("#datepicker").kendoDatePicker({
                open: onChange,
                value: new Date()
            });

        })
    </script>
</div>

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

Controller

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

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using SparklineChart.Models;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Newtonsoft.Json.Linq;

namespace SparklineChart.Controllers
{
    public class HomeController : Controller
    {
        private static Class1[] _download_serialized_json_data<ActualPower>(string url) where ActualPower : new()
        {
            //This is to temporarily to disable the SSL Certificate check.
            ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
            { return true; };

            using (var w = new WebClient())
            {
                var json_data = string.Empty;
                try 
                {
                    json_data = w.DownloadString(url);
                }
                catch (Exception ) { }
                return !string.IsNullOrEmpty(json_data) ? JsonConvert.DeserializeObject<Class1[]>(json_data) : new Class1[] { };

            }
        }

        [HttpGet]
        public ActionResult Index()
        {

            var url = "https://raise.tra.trafficmanager.net/apiv1/abb/raise/rest/measured/9fcecb42-7dfc-407e-bf31-a447f0650447/Actual%20Power";
            var actualPower = _download_serialized_json_data<ActualPower>(url);
            Dictionary<DateTime, decimal> power = new Dictionary<DateTime, decimal>();
            List<decimal> value = new List<decimal>();
            List<DateTime> timeStamp = new List<DateTime>();
            foreach (var item in actualPower)
            {
                power.Add(Convert.ToDateTime(item.timeStamp.localTimeStamp), Convert.ToDecimal(item.deviceData.value));
                value.Add(Convert.ToDecimal(item.deviceData.value));
                timeStamp.Add(Convert.ToDateTime(item.timeStamp.localTimeStamp));
            }
            ViewBag.Power = power;
            ViewBag.Value = value;
            ViewBag.TimeStamp = timeStamp;
            return View();
        }
        

        [HttpPost]
        public String Index(DateTime date)
        {
            if (date != null)
            return "Success";
            return "Failure";
            //return Content(Convert.ToString(date));
        }

        public ActionResult About()
        {
            return View();
        }


    }
}

Georgi Krustev
Telerik team
 answered on 12 Sep 2015
9 answers
273 views

Hi 

I have question to you how I can pass id to my custom popup.
The whole problem is that I need to load specific data to my dropdownlist. and I need pass id off item which is in edition.

I tried:

  • use JavaScript function in  .Data("passCategoryId") but I don't know how to get item clicked to edition. ​I tried setup id in onEdit event in TreeList but it is call afer function passCategoryId...
  • I tried also go this way but also when I check passed value is null

@Html.Kendo().DropDownListFor(m => m.Level).DataTextField("Text").DataValueField("Value").DataSource(dataSoruce => dataSoruce.Read(read => read.Action("LoadPosibleOrderDll", "ProductCategories", new { categoryId = Model.ParentCategory })))

 

model of tree list

.Model(model =>   {         model.Id(p => p.Id);
                            model.ParentId(p => p.ParentId);                             model.Field(p => p.Id).Editable(false);                             model.Field(p => p.Level);                             model.Field(p => p.ProductCategoryOrder);                             model.Field(p => p.Parent.Name);                             model.Field(p => p.OrderPosibilities );                                                      })​

Rosen
Telerik team
 answered on 11 Sep 2015
1 answer
103 views

I am storing the values selected with my Cascading ComboBoxes in the local storage so it will remember what they have chosen.  The problem is when the browser back button in clicked, the Cascaded combobox's Datasource is empty so when I set the value it just puts the # in the drop down instead of showing the selected item.  

 From what I can tell it is not calling the read method when the back button is pressed and is not cacheing the list since I am using ServerFiltering.  I have even tried manually calling the read method of the datasource in JavaScript but to no avail.

 How can I get this list to re-populate when the back button is used?

<div class="col-md-6">
    @(Html.Kendo().ComboBox()
        .Name("Clients")
        .DataValueField("ClientId")
        .DataTextField("ClientName")
        .Placeholder("Select Client...")
        .Filter(FilterType.Contains)
        .Events(events => events.Cascade("Clients_cascade").Change("Clients_change"))
        .DataSource(ds => ds
            .Read(read => read.Action("GetClients", "Home")))
    )
</div>
<div class="col-md-6">
    @(Html.Kendo().ComboBox()
        .Name("Projects")
        .DataValueField("ProjectId")
        .DataTextField("ProjectName")
        .Placeholder("Select Project...")
        .Filter(FilterType.Contains)
        .AutoBind(false)
        .CascadeFrom("Clients")
        .Events(events => events.Change("Projects_change"))
        .DataSource(ds => ds
            .Read(read => read.Action("GetProjectsForClient", "Home").Data("FilterProjects"))
            .ServerFiltering(true)
            .Events(events => events.Error("Projects_error")))
    )
</div>

Georgi Krustev
Telerik team
 answered on 11 Sep 2015
6 answers
304 views
We were using Kendo Grid ever since and the normal process is that the when clicking the custom command it would also fire the Row Select Event but now that we've upgraded our Kendo version to support IE11 that process has changed. Clicking the Custom Command does not fire the Row Select Event anymore. Is there anyway to incorporate it back again?
Patrick
Top achievements
Rank 1
 answered on 11 Sep 2015
1 answer
121 views
Currently When i try to render a window using Kendo.Window, it is rendered outside a defined div. How to render a kendo window inside a given div?
Plamen Lazarov
Telerik team
 answered on 10 Sep 2015
2 answers
547 views

I have worked based on : .Filter(filter => filter.Add(/* your filter rule */)) , that I found in here.

 My code is : 

  var grid =
        Html.Kendo().Grid<dynamic>().Name(Model.Current.Id).HtmlAttributes(new
        {

           // lot of stuff

       }

 grid.DataSource(ds =>
    {
        var ajaxDsBuilder = ds.Ajax();
        ajaxDsBuilder.Model(model => model.Id("ID")).Events(ev => ev.Error("gridOnError")).ServerOperation(Model.Current.LazyLoading);

// mode code

      var cols = Model.Current.Columns.ToList();

           foreach (var col in cols)
              {​

                 ajaxDsBuilder.Sort(sort => sort.Add(col.Name).Ascending()); // this works perfect for pre-sorting     ( col.Name = the column name ) 

                 ajaxDsBuilder.Group(grp => grp.Add(col.Name, typeof(string))); // this the same works great for pre-grouping

 

 ​but when I try this:

          ajaxDsBuilder.Filter(f => f.Add(c=> c.col.Name).IsEqualTo("TEST")); ​

I get : Error309 An expression tree may not contain a dynamic operation 

 

if I try:  ajaxDsBuilder.Filter(f => f.Add(c=> col.Name.ToString()).IsEqualTo("TEST")); ​// I am overriding ToString() to give me the name of column

I get : Internal server error

 

 if I try:  ajaxDsBuilder.Filter(f => f.Add(c=> col.Name).IsEqualTo("TEST")); 
I get : Property with specified name: col.Name cannot be found on type: System.Data.DataRowView

 

I have also worked with lambda expressions, but I have pretty much the same errors. 

My grid has to be dynamic, so I can't change that.

Any help?

Anca
Top achievements
Rank 1
 answered on 10 Sep 2015
8 answers
1.7K+ views

Hello.

 I am using the following:

 Asp.net MVC 5

Ajax binding

Inline Editing

I need to pass a value to to the grid so it is populated automatically (see attached screenshot).  I have google'd looked at these forums, but the following doesn't seem to populate the value in the grid.

.Read(read => read.Action("CustomerClass_Read", "CustomerClass").Data("{ CustomerId: " + @Model.CustomerId + "}"))

I know how to do this with through an Actionlink:

 

@Html.ActionLink("New", "Create", "ShipTo", new { CustomerId = Model.CustomerId }, new { @class = "btn btn-default btn-sm" })

Please advise.

 Thanks

 

Jeff
Top achievements
Rank 1
 answered on 09 Sep 2015
4 answers
1.6K+ views
Anyone know how I can display a utc date/time I'm getting from my server as the user's local time? I'm putting this date/time in a ClientRowTemplate if that matters. 
Radoslav
Telerik team
 answered on 09 Sep 2015
1 answer
526 views
Hello,
I have a problem with setting the selection color in Kendo Editor in inline mode.
What I've discovered is that if a text inside the editor is not formatted everything is fine (meaning, selecting text with mouse highlight it with system defined color). Eveything breaks when add some styling. Bolding or underscoring text results in while color when selecting text.

I've observed the same issue on Components page (http://demos.telerik.com/kendo-ui/editor/inline-editing)

What could be the solution for this issue?
Dimo
Telerik team
 answered on 09 Sep 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?