Hello,
when will be the support available for RC version?
Best Regards
Any time I try to do an update with InCell editing I get a javascript error as soon as I click out of the cell button.
function anonymous(d) {
return d.x.Col2 // 0x800a138f - JavaScript runtime error: Unable to get property 'Col2' of undefined or null reference
}
The d value seems to have my object (CP_FailureStrategyMatrixRow) in it just fine, i.e. it has a attribute called "Col2" that has a valid value in it. I feel everything would work just fine if it was doing "d.Col2", instead of looking in some inner value called x. But I have no idea where this "x" is coming from.
It never even gets to the server-side code:
I have tried it with both versions of the CRUD operations, as the examples on telerik seem to use both, but it doesn't seem to matter which update statement I use.
@model XDashboard.Models.GridModel@using Kendo;@using Kendo.Mvc;@using Kendo.Mvc.UI;@(Html.Kendo().Grid<XDashboard.Models.CP_FailureStrategyMatrixRow>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.Col1); columns.Bound(p => p.Col2).Width(140); columns.Bound(p => p.Col3).Width(140); //columns.Bound(p => p.ProbabilityOfFailureValue).Width(100); columns.Command(commands => { commands.Destroy(); // The "destroy" command removes data items }).Title("Commands").Width(200); }) // .Events(e => e.DataBound("OnChange")) //this will attach to the events for the grid .ToolBar(toolbar => { toolbar.Create(); // The "create" command adds new data items toolbar.Save(); // The "save" command saves the changed data items }) .Editable(editable => editable.Mode(GridEditMode.InCell)) // Use in-cell editing mode .DataSource(dataSource => dataSource.Ajax() .Batch(false) // Enable batch updates .Events(events => events.Error("error_handler")) //this will grab the events for the datasource, notice hwo we are inside the method for datasource .Events(events => events.Change("OnChange")) //.Events(events => events.Sync("OnChange")) .Model(model => { model.Id(product => product.ProbabilityOfFailureValue); // Specify the property which is the unique identifier of the model model.Field(product => product.ProbabilityOfFailureValue).Editable(false); // Make the ProductID property not editable }) .Create(create => create.Action("Create2", "ManagementStrats")) // Action method invoked when the user saves a new data item .Read(read => read.Action("Read", "ManagementStrats")) // Action method invoked when the grid needs data .Update(update => update.Action("Update2", "ManagementStrats")) // Action method invoked when the user saves an updated data item .Events(events => events.Error("error_handler")) .Destroy(destroy => destroy.Action("Destroy2", "ManagementStrats")) // Action method invoked when the user removes a data item ) .Pageable())<script type="text/javascript"> function error_handler(e) { if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function () { message += this + "\n"; }); } }); alert(message); } }}
public class ManagementStratsController : Controller{ public ActionResult Index() { return View(); } public ActionResult Read([DataSourceRequest] DataSourceRequest request) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); return Json(productService.Read().ToDataSourceResult(request)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<CP_FailureStrategyMatrixRow> products) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); var results = new List<CP_FailureStrategyMatrixRow>(); if (products != null && ModelState.IsValid) { foreach (var product in products) { productService.Create(product); results.Add(product); } } return Json(results.ToDataSourceResult(request, ModelState)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); var results = new List<CP_FailureStrategyMatrixRow>(); if (product != null && ModelState.IsValid) { productService.Create(product); results.Add(product); } return Json(results.ToDataSourceResult(request, ModelState)); } //[AcceptVerbs(HttpVerbs.Post)] //public ActionResult Update([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product) //{ // if (product != null && ModelState.IsValid) // { // XEntities db = new XEntities(); // ManagementStratsService productService = new ManagementStratsService(db); // } // return Json(new[] { product }.ToDataSourceResult(request, ModelState)); //} [AcceptVerbs(HttpVerbs.Post)] public ActionResult Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<CP_FailureStrategyMatrixRow> products) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); if (products != null && ModelState.IsValid) { foreach (var product in products) { productService.Update(product); } } return Json(products.ToDataSourceResult(request, ModelState)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Update2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); if (product != null && ModelState.IsValid) { productService.Update(product); } return Json(new[] { product }.ToDataSourceResult(request, ModelState)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<CP_FailureStrategyMatrixRow> products) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); if (products != null && ModelState.IsValid) { foreach (var product in products) { productService.Destroy(product); } } return Json(products.ToDataSourceResult(request, ModelState)); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Destroy2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product) { XEntities db = new XEntities(); ManagementStratsService productService = new ManagementStratsService(db); if (product != null && ModelState.IsValid) { productService.Destroy(product); } return Json(new[] { product }.ToDataSourceResult(request, ModelState)); } //public ActionResult Unique(string field) //{ // var result = GetCP_FailureStrategyMatrixRows().Distinct(new CP_FailureStrategyMatrixRowComparer(field)); // return Json(result, JsonRequestBehavior.AllowGet); //}}
public class CP_FailureStrategyMatrixRow{ public int ProbabilityOfFailureValue { get; set; } public string Col1 { get; set; } public string Col2 { get; set; } public string Col3 { get; set; } public string Col4 { get; set; } public string Col5 { get; set; } public string Col6 { get; set; } public string Col7 { get; set; } public string Col8 { get; set; } public string Col9 { get; set; } public string Col10 { get; set; } internal CP_FailureStrategyMatrix_Test transform() { CP_FailureStrategyMatrix_Test row = new CP_FailureStrategyMatrix_Test(); row.Col1 = Col1.Length == 1 ? (int?)(Char.GetNumericValue(Col1[0]) - 64) : null; row.Col2 = Col2.Length == 1 ? (int?)(Char.GetNumericValue(Col2[0]) - 64) : null; row.Col3 = Col3.Length == 1 ? (int?)(Char.GetNumericValue(Col3[0]) - 64) : null; row.Col4 = Col4.Length == 1 ? (int?)(Char.GetNumericValue(Col4[0]) - 64) : null; row.Col5 = Col5.Length == 1 ? (int?)(Char.GetNumericValue(Col5[0]) - 64) : null; row.Col6 = Col6.Length == 1 ? (int?)(Char.GetNumericValue(Col6[0]) - 64) : null; row.Col7 = Col7.Length == 1 ? (int?)(Char.GetNumericValue(Col7[0]) - 64) : null; row.Col8 = Col8.Length == 1 ? (int?)(Char.GetNumericValue(Col8[0]) - 64) : null; row.Col9 = Col9.Length == 1 ? (int?)(Char.GetNumericValue(Col9[0]) - 64) : null; row.Col10 = Col10.Length == 1 ? (int?)(Char.GetNumericValue(Col10[0]) - 64) : null; row.ProbabilityOfFailureValue = ProbabilityOfFailureValue; return row; } //public partial class CP_FailureStrategyMatrix_Test //{ // public int ProbabilityOfFailureValue { get; set; } // public Nullable<int> Col1 { get; set; } // public Nullable<int> Col2 { get; set; } // public Nullable<int> Col3 { get; set; } // public Nullable<int> Col4 { get; set; } // public Nullable<int> Col5 { get; set; } // public Nullable<int> Col6 { get; set; } // public Nullable<int> Col7 { get; set; } // public Nullable<int> Col8 { get; set; } // public Nullable<int> Col9 { get; set; } // public Nullable<int> Col10 { get; set; } //}}Every time the chart is drawn the background is set to gray. No matter if the theme is specified or not or if the chart area background is set to "", "transparent" or any color, or not at all.
You can see a blank chart with the correct background color prior to the read occurring and the chart being redrawn with the appropriate data. Each path element in the SVG has a stroke color set to "#dfdfdf"
Here is the code:
@(Html.Kendo( ).Chart<ViewModels.HistoryChartModel>( )
.Name( "chart" )
.ChartArea(c=>c.Width(800).Height(600))
.DataSource( dataSource => dataSource
.Read( read => read.Action( "Series", "Home" ) )
.Group( group => group.Add( model => model.BasinName ) )
.Sort( sort => sort.Add( model => model.ReadingDateTime ).Descending( ))
)
.Series( series => {series.Line( model => model.LevelReading ).Name( "#= group.value # " ).Markers(false);} )
.Legend( legend => legend.Position( ChartLegendPosition.Bottom ))
.ValueAxis( a => a.Numeric( ).Min( 3 ).Max(10).MinorTicks(mt=>mt.Visible(false)).MajorUnit(.5) )
)
public JsonResult GetCustomers() { return Json(CustomerRepository.Repository.Customers, JsonRequestBehavior.AllowGet); } public JsonResult GetVendors(int customerId,int customerId2) { return Json(VendorRepository.Repository.GetVendorsByCustomer(customerId), JsonRequestBehavior.AllowGet); }function filterVendors() { return { customerId: $("#CustomerId").data("kendoAutoComplete").value(), customerId2: $("#CustomerId").data("kendoAutoComplete").value(), };}function filterProducts() { return { vendorId: $("#VendorId").data("kendoDropDownList").value() };}
<dl> <dt> @Html.LabelFor(m => m.CustomerId): </dt> <dd> @(Html.Kendo().AutoCompleteFor(m => m.CustomerId).Name("CustomerId") .ValuePrimitive(true) .DataTextField("CustomerId") .DataSource(dataSource => { dataSource.Read(read => read.Action("GetCustomers", "Home")) .ServerFiltering(true); }) ) @Html.ValidationMessageFor(m => m.CustomerId) </dd></dl><dl> <dt> @Html.LabelFor(m => m.VendorId): </dt> <dd> @(Html.Kendo().DropDownListFor(m => m.VendorId) .AutoBind(false) .ValuePrimitive(true) .OptionLabel("Select Vendor...") .DataTextField("VendorName") .DataValueField("VendorId") .DataSource(dataSource => { dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors")) .ServerFiltering(true); }) .CascadeFrom("CustomerId") ) @Html.ValidationMessageFor(m => m.VendorId) </dd></dl>Can I give a dropdownlist's CascadeFrom parameter a AutoComplete? I have tried it but it didn't work.
public JsonResult GetCustomers() { return Json(CustomerRepository.Repository.Customers, JsonRequestBehavior.AllowGet); } public JsonResult GetVendors(int customerId,int customerId2) { return Json(VendorRepository.Repository.GetVendorsByCustomer(customerId), JsonRequestBehavior.AllowGet); }
function filterVendors() { return { customerId: $("#CustomerId").data("kendoAutoComplete").value(), customerId2: $("#CustomerId").data("kendoAutoComplete").value(), };}function filterProducts() { return { vendorId: $("#VendorId").data("kendoDropDownList").value() };}
<dl> <dt> @Html.LabelFor(m => m.CustomerId): </dt> <dd> @(Html.Kendo().AutoCompleteFor(m => m.CustomerId).Name("CustomerId") .ValuePrimitive(true) .DataTextField("CustomerId") .DataSource(dataSource => { dataSource.Read(read => read.Action("GetCustomers", "Home")) .ServerFiltering(true); }) ) @Html.ValidationMessageFor(m => m.CustomerId) </dd></dl><dl> <dt> @Html.LabelFor(m => m.VendorId): </dt> <dd> @(Html.Kendo().DropDownListFor(m => m.VendorId) .AutoBind(false) .ValuePrimitive(true) .OptionLabel("Select Vendor...") .DataTextField("VendorName") .DataValueField("VendorId") .DataSource(dataSource => { dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors")) .ServerFiltering(true); }) .CascadeFrom("CustomerId") ) @Html.ValidationMessageFor(m => m.VendorId) </dd></dl>I have a Razor for that has several Autocomplete fields on it.
Some of these fields are required, some are not required.
I need to show the required fields in a red border and a blue background, while non-required fields are white, with a blue border.
My css works for a regular text field, but i cannot figure out how to make it work for an autocomplete field.
How would I do that? I have tried " .HtmlAttributes(new { @class="rsireqtext",style = "width: 99%;" }) " in the autocomplete (rsireqtext is my 'required' styling),
but that doesn't do it.
Any ideas?
TIA,
Bob Mathis

Using Kendo UI for ASP.NET MVC, I am creating and passing in a Model that contains a collection of objects (called ChartSeries) that has fields for Color, SeriesName, and a collection of a second class (ChartSeriesValue) which contains fields Value, Date. I am trying to create a line chart using this local data with a dynamic number of series. Using a foreach statement, I can get the different series values plotted, but am unable to get the Dates to display using CategoryAxis. Will I have to go the route of using DataSource to group the flattened data, or is it possible to accomplish this using localdata?
Here are the chart-related classes I am using:
public class ChartSeries { public string SeriesName { get; set; } public string ValueType { get; set; } public string HexColor { get; set; } public IList<ChartSeriesValue> ChartSeriesValues { get; set; } }public class ChartSeriesValue { public decimal? Value { get; set; } public DateTime Effective { get; set; } }
Thus far, I have been able to get either the lines with proper values, or just the X-Axis date labels to display, but not both. Here's my current attempt that displays proper line series data without X-Axis labels:
@(Html.Kendo().Chart<ChartSeriesValue>() .Name("myChart_" + Model.MyChart.Id) .Title(Model.MyChart.Name) .Legend(legend => legend .Position(ChartLegendPosition.Bottom) ) .ChartArea(chartArea => chartArea .Background("transparent") .Width(250) .Height(250) ) .SeriesDefaults(seriesDefaults => seriesDefaults.Line().Style(ChartLineStyle.Smooth) ) .Series(series => { if (!Model.ChartSeriesList.IsNullOrEmpty()) { foreach (var metSeries in Model.ChartSeriesList) { if (!metSeries.ChartSeriesValues.IsNullOrEmpty()) { series.Line(metSeries.ChartSeriesValues) .Field("Value") .Name(metSeries.SeriesName) .Color(metSeries.HexColor); } } } }) .CategoryAxis(axis => axis .Categories(x => x.Effective.Date) .Name("Effective Date") //.Name("Effective") //.MajorGridLines(lines => lines.Visible(true)) //.Date().BaseUnit(ChartAxisBaseUnit.Months) .Labels(labels => labels.Visible(true)) .Color("Red")//.Rotation(-60)) //.Type(ChartCategoryAxisType.Date) ) ))
Please let me know if you need further clarification. Thanks!
I have a very simple grid. For this grid only is there a way to disable the row hover highlight? I want it everwhere else, just not for this grid.
@(Html.Kendo().Grid<SalesRepSummaryItem>()
.Name("grid")
.NoRecords()
.Sortable()
.Columns(columns =>
{
columns.Bound(c => c.SalesRepFullName).Title("Sales Rep");
columns.Bound(c => c.TotalSales).Title("Invoiced Sales").Format("{0:c}").HtmlAttributes(new { @class = "money" }).Width(150);
columns.Bound(c => c.CalculatedTotalSales).Title("Total Sales").Format("{0:c}").HtmlAttributes(new { @class = "money" }).Width(150);
columns.Bound(c => c.NumberOfOrders).Title("# of Orders").Format("{0:0}");
columns.Bound(c => c.NumberOfItems).Title("# Of Items").Format("{0:0}");
columns.Bound(c => c.TotalOrdered).Title("Qty Ordered").Format("{0:0}");
columns.Bound(c => c.TotalShipped).Title("Qty Shipped").Format("{0:0}");
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Url(Url.HttpRouteUrl("Default", new { controller = "SalesRep", action = "Sales_GetSalesData" })).Data("getFilterValuesForGridRead")))