Currently, we have a chart situated within an ASP.NET MVC view without a title. When a user clicks an export button on the view, the chart is successfully created, however, business owners require the tile in the exported image. Is there any way to add a title to the chart prior to exporting it, or add one to the MVC chart and not display it in the view, just in the export? I've tried the following without success:
$("#btnExport").on("click", function () { var titleVal = $(this).data("name"); // this should be the exported chart title var chart = $("#myChart").getKendoChart(); chart.options.title = titleVal; //chart.options.Title = titleVal; chart.exportImage().done(function (data) { kendo.saveAs({ dataURI: data, fileName: "MyChart.png", proxyURL: '@Url.Action("Export_Save", "MyController")' }); });});
Any help or guidance would be greatly appreciated!
<script type="text/x-kendo-template" id="template">
<div id="details-container">
<p>标题:#=Title#</p>
<p>内容:#=Content#</p>
<p>状态:#=Passstatus#</p>
<p>提交人:#=SendPerson#</p>
<p>提交时间:#=SendDate#</p>
<div class="demo-section k-content wide">
@(Html.Kendo().ListView<txlcinfo.EnSystem.ViewModels.QuImgsViewModel>()
.Name("imglistView")
.TagName("div")
.ClientTemplateId("img_template")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("img_Read", "UserDiscuss", new { sid = "#=ID#" }));
dataSource.PageSize(3);
})
.Pageable()
)
</div>
</div>
</script>
That's my code,but it has problem,like this:
Uncaught Error: Invalid template:'
<div id="details-container">
<p>标题:#=Title#</p>
<p>内容:#=Content#</p>
<p>状态:#=Passstatus#</p>
<p>提交人:#=SendPerson#</p>
<p>提交时间:#=SendDate#</p>
<div class="demo-section k-content wide">
<div id="imglistView"></div><div class="k-pager-wrap" id="imglistView_pager"></div><script>
jQuery(function(){jQuery("#imglistView").kendoListView({"dataSource":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":"/Admin/UserDiscuss/img_Read?sid=#=ID#"},"prefix":""},"pageSize":3,"page":1,"total":0,"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"filter":[],"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"ID":{"type":"string"},"imgpath":{"type":"string"}}}}},"template":kendo.template(jQuery('#img_template').html()),"pageable":{"autoBind":false,"buttonCount":10,"messages":{"display":"显示条目 {0} - {1} 共 {2}","empty":"没有可显示的记录。","page":"页","of":"共 {0}","first":"首页","previous":"前页","next":"后页","last":"末页","refresh":"刷新","morePages":"更多页"},"pagerId":"imglistView_pager"}});});
' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='\n <div id="details-container">\n <p>标题:'+(Title)+'</p>\n <p>内容:'+(Content)+'</p>\n\n \n\n\n\n <p>状态:'+(Passstatus)+'</p>\n <p>提交人:'+(SendPerson)+'</p>\n <p>提交时间:'+(SendDate)+'</p>\n <div class="demo-section k-content wide">\n <div id="imglistView"></div><div class="k-pager-wrap" id="imglistView_pager"></div><script>\n\tjQuery(function(){jQuery("';imglistView").kendoListView({"dataSource":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":"/Admin/UserDiscuss/img_Read?sid=;$kendoOutput+='=ID';"},"prefix":""},"pageSize":3,"page":1,"total":0,"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"filter":[],"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"ID":{"type":"string"},"imgpath":{"type":"string"}}}}},"template":kendo.template(jQuery(';$kendoOutput+='img_template\').html()),"pageable":{"autoBind":false,"buttonCount":10,"messages":{"display":"显示条目 {0} - {1} 共 {2}","empty":"没有可显示的记录。","page":"页","of":"共 {0}","first":"首页","previous":"前页","next":"后页","last":"末页","refresh":"刷新","morePages":"更多页"},"pagerId":"imglistView_pager"}});});\n';}return $kendoOutput;'

Hi,
I'm trying to use a grid with resizable height so it uses 100% no matter the resolution used, and so far I could replicate the examples given by the Telerik support when working on a HTML single page, but when trying to use the same approach in a MVC master layout + view,I can't make it work.
These are the examples I followed:
http://docs.telerik.com/kendo-ui/controls/layout/splitter/how-to/expand-splitter-to-100-height
http://jsfiddle.net/dimodi/4eNu4/33/ (from a forum question)
Also, I'm trying to make the grid in razor style, not via script like the examples, but somehow I'm not able to do it.
I'm linking for download (the MVC projects weights too much to attach) the 2 working standalone projects I made for testing purposes, the one in HTML works fine and the one with MVC pattern doesn't when resizing the browser window.
https://drive.google.com/open?id=0B4xs_h7M8cSXT016d3JPRV9LR1k (HTML)
https://drive.google.com/open?id=0B4xs_h7M8cSXcUZwTE94MWw0MW8 (MVC)
Could you help me please?
Thanks in advance.

I have written code for so many grids. But this one grid is giving me trouble. Not sure what the problem is. Its a basic master table grid with read/create/delete. Read and Delete get called but for some reason create and update don't get invoked. Any ideas?
View file Code:
@using Kendo.Mvc.UI;
@{
ViewBag.Title = "Import FileNames";
}
<h4>Maintain Import FileNames</h4>
@(Html.Kendo().Grid<CaseManagement.Models.ImportFileModel>()
.Name("importFileGrid")
.Columns(columns =>
{
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
columns.ForeignKey(p => p.InventoryType, (System.Collections.IEnumerable)ViewData["InventoryTypeList"], "InventoryCode", "Title").HeaderTemplate("<b>Inventory</b>").Width(150);
columns.Bound(o => o.FileName).Title("File Name");
//columns.Bound(o => o.importId);
//columns.Bound(o => o.InventoryType);
})
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<div class="toolbar">
<div style="float: right;">
<a class="k-button k-button-icontext k-grid-add" href="#"><span class="k-icon k-add"></span>Add new row</a>
</div>
</div>
</text>);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
//.Events(events => events.DataBound("onImportFileGridDataBound"))
.HtmlAttributes(new { style = "width: 1000px;" })
.Scrollable()
.Sortable()
.Groupable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100000)
.Model(model =>
{
model.Id(p => p.importId);
//model.Field(p => p.ImportFileId).DefaultValue("");
})
.Read(read => read.Action("ImportFile_Read", "ImportFile"))
.Create(create => create.Action("ImportFile_Create", "ImportFile"))
.Update(update => update.Action("ImportFile_Update", "ImportFile"))
.Destroy(destroy => destroy.Action("ImportFile_Destroy", "ImportFile"))
)
)
<script type="text/javascript">
function onImportFileGridDataBound() {
this.table.find(".k-grid-edit").hide();
}
</script>
Controller code:
public class ImportFileController : Controller
{
public ImportFileController()
{
ViewData["InventoryTypeList"] = InventoryType.GetInventoryTypes().Select(t => new InventoryType
{
InventoryCode = t.InventoryCode,
Title = t.Title,
DisplayOrder = t.DisplayOrder
}).OrderBy(t => t.DisplayOrder);
}
public ActionResult ImportFileName()
{
return View();
}
public ActionResult ImportFile_Read([DataSourceRequest]DataSourceRequest request)
{
return Json(GetImportFiles().ToDataSourceResult(request));
}
private static IEnumerable<ImportFileModel> GetImportFiles()
{
List<ImportFile> objList;
objList = ImportFile.GetImportFileAll();
int ctr = 1;
List<ImportFileModel> modelList = new List<ImportFileModel>();
foreach(ImportFile item in objList)
{
ImportFileModel m = new ImportFileModel();
m.importId = ctr;
m.InventoryType = item.InventoryType;
m.FileName = item.FileName;
modelList.Add(m);
ctr++;
}
return modelList;
//return objList.Select(obj => new ImportFileModel
//{
// importId =
// ImportFileId = obj.InventoryType + "_" + obj.FileName,
// InventoryType = obj.InventoryType,
// FileName = obj.FileName,
//});
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ImportFile_Create([DataSourceRequest] DataSourceRequest request, ImportFileModel model)
{
if (model != null && ModelState.IsValid)
{
var obj = new ImportFile();
CopyModelToObject(model, obj);
obj.Insert();
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ImportFile_Update([DataSourceRequest] DataSourceRequest request, ImportFileModel model)
{
if (model != null && ModelState.IsValid)
{
var obj = new ImportFile();
CopyModelToObject(model, obj);
//obj.Save();
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ImportFile_Destroy([DataSourceRequest] DataSourceRequest request, ImportFileModel model)
{
if (model != null)
{
var obj = new ImportFile();
CopyModelToObject(model, obj);
//obj.Delete();
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
private void CopyModelToObject(ImportFileModel model, ImportFile obj)
{
obj.InventoryType = model.InventoryType;
obj.FileName = model.FileName;
obj.RecordAddedBy = User.Identity.Name.Substring(User.Identity.Name.IndexOf(@"\") + 1);
}
}
Hi, I need help.
I'm working with asp.net Core 1.0 RC1 and the Telerik UI for ASP.NET MVC Q2 2016 with latest .714 patch
I would like to pass the content of an editor to my controller when clicking on a button without use of a model.
My View
<p> <a asp-action="SaveScreen" asp-route-strValue="???????" asp-route-strMessage="My Message" id="#LINE1_SCR" SaveScreen" class="btn btn-primary">Save</a></p><div> @(Html.Kendo().Editor() .Name("LINE1_SCR") .Tools(tools => tools.Clear().Bold().FontName().ForeColor().BackColor()) .Tag("DivLine") .Value(@<text><p>Content of the editor</p></text>) )</div>My controller
public async Task<IActionResult> SaveScreen(string strMessage) { var strControllerMessage = strMessage; return View(); }As you can see I pass parameters using the "asp-route..." razor syntax feature of asp.net core.
But I don't find any way to use the right syntax for passing the content of the editor in the "strValue" parameters of the push button.
Any help will be very appreciated.
Best regards.

Using below code to render date as month picker.
@(Html.Kendo().DatePickerFor(d => d.StartDate).Format("MM/yyyy")
.ParseFormats(new String[] {"MM/yyyy" }))
But the validation error showing "The field Start Date must be a date.". The property StartDate is DateTime nullable field.
I have to use a month picker in my page.

| How to Name different Custom Group Client Footer Names for a Grid in MVC. | |
Hi ,
I have a grid that has some aggregate values . it also contains different groups. all group amounts are added and displayed in footer as sum.
coming to the groups I have different groups .
below is code :
<div class="grid-scrollable">
<div>
@(Html.Kendo().Grid<ViewModels.Payment.BhFormExpenseRRViewModel>()
.Name("BHFormPATHRRGrid")
.Events(e => e.DataBound("dataBoundpath"))
.Events(e => e.Save("onBhFormpathModelGridSave"))
.Events(e => e.Edit("onBhFormpathModelGridEdit"))
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden(true);
columns.Bound(p => p.ECId).Hidden(true);
columns.Bound(p => p.ExpenseCategory).ClientFooterTemplate("Total Payment Requested")
.ClientGroupFooterTemplate("Total Expenses").EditorTemplateName("Decimal").Format("{0:c}");
columns.Group(g => g.Title("Current Month Expenses")
.Columns(a =>
{
a.Bound(c => c.ThisMonthPath).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
a.Bound(c => c.ThisMonthMatch).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
}));
columns.Group(g => g.Title("Reduced Monthly Expenses")
.Columns(a =>
{
a.Bound(c => c.ReduceExpensesBy).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
a.Bound(c => c.CurrentMonthExpensesSubmitted).EditorTemplateName("Decimal").Title("AdjustedPathAmount").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
}));
columns.Group(g => g.Title("Prior Month Expenses")
.Columns(a =>
{
a.Bound(c => c.PriorMonthMatch).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
a.Bound(c => c.PriorMonthPath).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
}));
columns.Group(g => g.Title("Cumulative Expenses YTD")
.Columns(a =>
{
a.Bound(c => c.YtdMonthMatch).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
a.Bound(c => c.YtdMonthPath).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
.ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
}));
columns.Command(command =>
{
command.Edit().HtmlAttributes(new { @class = "btn-primary k-grid-edit" });
}).Width(200);
})
.Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
.Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
.Sortable()
.Filterable(f => f.Operators(o => o.ForString(s => s.Clear()
.Contains("Contains")
.DoesNotContain("Does not contain")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.StartsWith("Starts with")
.EndsWith("Ends with "))))
.Selectable()
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource.Ajax().PageSize(20).Model(model => model.Id(p => p.ECId)).Model(model => model.Field(p => p.TotalProirExpensesBilled).Editable(false)).Model(model => model.Field(p => p.CurrentMonthExpensesSubmitted).Editable(false)).Model(model => model.Field(p => p.TotalExpensesYtd).Editable(false)).Model(model => model.Field(p => p.ExpenseCategory).Editable(false))
.Model(model => model.Field(p => p.PriorMonthMatch).Editable(false)).Model(model => model.Field(p => p.PriorMonthPath).Editable(false)).Model(model => model.Field(p => p.YtdMonthMatch).Editable(false)).Model(model => model.Field(p => p.YtdMonthPath).Editable(false))
.Aggregates(aggregates =>
{
aggregates.Add(p => p.ThisMonthMatch).Sum();
aggregates.Add(p => p.ThisMonthPath).Sum();
aggregates.Add(p => p.PriorMonthMatch).Sum();
aggregates.Add(p => p.PriorMonthPath).Sum();
aggregates.Add(p => p.YtdMonthMatch).Sum();
aggregates.Add(p => p.YtdMonthPath).Sum();
aggregates.Add(p => p.ReduceExpensesBy).Sum();
aggregates.Add(p => p.CurrentMonthExpensesSubmitted).Sum();
})
.Update(update => update.Action("EditBHFormRR", "ReimbursementRequestProvider").Data("additionalInfoPath"))
.Events(events => events.Error("errorpath"))
.Group(groups => groups.Add(p => p.ExpenseTypeId))
.Read(read => read.Action("BHFromExpenseGridRead", "ReimbursementRequestProvider", new { bhFormName = Model.BHFormsName, reimbursementEbsId = Model.ReimbursementEbsId, prrId = Model.PrrId, rrState = @ViewBag.RRStateRequest, serviceMonth = Model.ServiceMonth }))
)
)
</div>
</div>
now my requirement is to
change group client footer of group 1 to "Total Payment Requested"
change group clientfooter of group 2 to "Total Match Claimed"
TOTAL OF TOTAL AS "Total Billing Submitted" instead of ""

Hi,
I have a page with a grid with .Selectable(s => s.Type(GridSelectionType.Row).Mode(GridSelectionMode.Multiple)) and can select multiple lines. And I have a DropDownList.
What I want is to send an array of selected lines in the grid to the server AND the information of the dropdownlist.
If I want only one of this information I know how to do it but somewhere my ajax call gets corrupted.
If I have the following:
View:
var items= {};
var grid = $('#grid').data('kendoGrid');
var selectedElements = grid.select();
for (var j = 0; j < selectedElements.length; j++) {
var item = grid.dataItem(selectedElements[j]);
items['projectMoveModels[' + j + '].ID'] = item.ID;
items['projectMoveModels[' + j + '].DateString'] = item.Date;
items['projectMoveModels[' + j + '].EmployeeID'] = item.EmployeeID;
items['projectMoveModels[' + j + '].Hours'] = item.Hours;
}
$.ajax({
type: "POST",
data: items,
url: '@Url.Action("Move", "Project")',
}
})
And in the controller
public ActionResult Move(IList<ProjectMoveModel> projectMoveModels)
I do receive all selected lines in projectMoveModels.
But I want more data so I changed it to
var type = 1; //info from the dropdownlist
$.ajax({
type: "POST",
data: { projectMoveModels: items, type: type },
with in the controller
public ActionResult Move(IList<ProjectMoveModel> projectMoveModels, object type)
Now projectMoveModels will became null
How can I fix this error?
Thanks in advance
Maurice

Hi,
I search how to show server validation error in a Grid like the client validation (see image in attach file for example).
My grid is a InCell edit mode.
This is my grid code :
@(Html.Kendo().Grid<Mentorat.Models.Intervention>() .Name("grid") .Columns(columns => { columns.Bound(c => c.Date_Intervention).Title("Date").Format("{0:yyyy/MM/dd HH:mm:ss}").Width(130).ClientGroupFooterTemplate("#= count # intervention(s)").ClientFooterTemplate("#= count # intervention(s)"); //columns.Bound(c => c.Date_Intervention).Width(130).Title("Date").ClientGroupFooterTemplate("#= count # intervention(s)").ClientFooterTemplate("#= count # intervention(s)").HtmlAttributes(new { @class = "templateCell" }).ClientTemplate(( // @Html.Kendo().DateTimePicker().Name("date_#=No_Intervention#").Format("{0:yyyy/MM/dd HH:mm}").HtmlAttributes(new { data_bind = "value:Date_Intervention" }).ToClientTemplate()).ToHtmlString() //); columns.Bound(c => c.Duree_Intervention).Title("Durée (min.)").Width(70).ClientGroupFooterTemplate("Total : #= kendo.format('{0:0.00}', sum/60)# hrs").ClientFooterTemplate("Total : #= kendo.format('{0:0.00}', sum/60)# hrs"); columns.ForeignKey(c => c.No_Mentore_Intervention, (System.Collections.IEnumerable) ViewData["ListeMentor"], "No_Mentore", "NomComplet_Mentore").Title("Mentoré").Width(160).ClientGroupHeaderTemplate("#= getHeaderMentores(value,data)#"); columns.Bound(c => c.Description_Intervention).Title("Description").Width(300); columns.Command(command => { command.Destroy(); }).Width(65); }) .ToolBar(toolbar => { toolbar.Create(); toolbar.Custom().Name("RepartirTemps").Text("Répartir").HtmlAttributes(new { id = "RepartirTemps", @class = "k-plus" }).Url("#"); toolbar.Save(); toolbar.Excel(); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Pageable() .Filterable(ftb => ftb.Mode(GridFilterMode.Menu)) .Groupable() .Events(events => events.DataBound("onDataBound")) .Events(events => events.Edit("onEdit")) .DataSource(dataSource => dataSource .Ajax() .Events(e => e.Change("onChange")) .Events(e => e.Error("onError")) .Batch(true) .PageSize(100) .Model(model => model.Id(p => p.No_Intervention)) .Read(read => read.Action("Interventions_Read", "Interventions")) .Create(create => create.Action("Interventions_Create", "Interventions")) .Update(update => update.Action("Interventions_Update", "Interventions")) .Destroy(destroy => destroy.Action("Interventions_Destroy", "Interventions")) .ServerOperation(false) //nouveau.... .Aggregates(ag => { ag.Add(p => p.Duree_Intervention).Sum(); ag.Add(p => p.Date_Intervention).Count(); }) ))This is my controller update code :
[AcceptVerbs(HttpVerbs.Post)]public ActionResult Interventions_Update([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Intervention> interventions){ var entities = new List<Intervention>(); if (interventions != null && ModelState.IsValid) { if (ValiderGrid(interventions)) { foreach (var intervention in interventions) { var entity = new Intervention { No_Intervention = intervention.No_Intervention, Date_Intervention = intervention.Date_Intervention, No_Mentor_Intervention = (int) Session["intNoMentor"], No_Mentore_Intervention = intervention.No_Mentore_Intervention, Duree_Intervention = intervention.Duree_Intervention, Description_Intervention = intervention.Description_Intervention }; entities.Add(entity); db.Interventions.Attach(entity); db.Entry(entity).State = EntityState.Modified; } db.SaveChanges(); } } var resultData = new[] { interventions }; return Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState)); }private Boolean ValiderGrid(IEnumerable<Intervention> interventions){ foreach (var intervention in interventions) { if(intervention.Date_Intervention == null) { ModelState.AddModelError("Date_Intervention", "Vous devez inscire une date."); } } return ModelState.IsValid;}I add in attach file a capture of my action error return.
i tried lot of solution with the error events. Each solution have a loop with this property "e.errors.length" but .lenth is undefined.
it is posible to show server error in the gird like client side error? Or i can only print a error message in a popup or in a div?
Thank for your help!

I try the example in mvc, but it can't useful. I think some .css or .js are less, When I use this ScrollView,http://demos.telerik.com/aspnet-mvc/scrollview/index ,How should I do?
