hi I have the following in my cshtml pages.
<div class="grid-scrollable">@(Html.Kendo().Grid<ViewModels.Admin.CDSUtilizationViewModel>() .Name("cdsgrid") .Columns(columns => { columns.Bound(c => c.Id).Width(150).Hidden(true); columns.Bound(c => c.Transaction_Id).Width(150).Hidden(true); columns.ForeignKey(p => p.Contract_Id, (System.Collections.IEnumerable)ViewData["ContractNumber"], "Id", "ContractNumber").Width(140); columns.ForeignKey(p => p.Contractor_Id, (System.Collections.IEnumerable)ViewData["ContractorName"], "Id", "ContractorName").Width(200); columns.ForeignKey(p => p.ServiceDetail_Id, (System.Collections.IEnumerable)ViewData["ServiceNameString"], "Id", "ServiceNameString").Width(300); columns.Bound(c => c.ServiceMonth).EditorTemplateName("Date").Format("{0:MMMM yyyy}").Width(120); columns.Bound(p => p.UnitsDelivered).EditorTemplateName("Integer").Width(80); columns.Command(command => { command.Edit().HtmlAttributes(new { @class = "btn-primary" }); command.Destroy().HtmlAttributes(new { @class = "btn-primary" }); }).Width(150); }) .ToolBar(tools => { tools.Create().Text("Add CDS Utilization Record").HtmlAttributes(new { @class = "btn-primary" }); tools.Excel().Text("Excel").HtmlAttributes(new { @class = "pull-right" }); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5)) .Selectable() .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 ")))) .Resizable(resize => resize.Columns(true)) .Events(e => e.Edit("oncdsutilizationGridEdit")) .Excel(excel => excel.FileName("CDSUtilization.xlsx").Filterable(true).AllPages(true)) .DataSource(dataSource => dataSource.Ajax().PageSize(10).Model(model => { model.Id(p => p.Id); model.Field(p => p.Id).Editable(false); }) .Read(read => read.Action("CDSUtilizationRead", "CDSContractUtilization")) .Create(create => create.Action("CDSUtilizationCreate", "CDSContractUtilization")) .Update(update => update.Action("CDSUtilizationUpdate", "CDSContractUtilization")) .Destroy(destroy => destroy.Action("CDSUtilizationDestroy", "CDSContractUtilization")) .Events(events => events.Error("error"))) )</div>
[AcceptVerbs(HttpVerbs.Post)] public ActionResult CDSUtilizationCreate([DataSourceRequest]DataSourceRequest request, CDSUtilizationViewModel cdsutilization)
{
if (ModelState.IsValid) { cdsutilization.CreateDate = DateTime.Now; cdsutilization.Transaction_Id = Convert.ToInt32(cDSUtilizationService.GenerateMaxTrasactionIdCDSUtlization()); var cdsutilizationDataObj = cDSUtilizationService.AddAndSave(Mapper.Map<CDSUtilizationViewModel, CDSUtilization>(cdsutilization)); cdsutilization.Id = cdsutilizationDataObj.Id; }
return Json(new[] { cdsutilization }.ToDataSourceResult(request, ModelState));
}
and I want to display only Month and Year calendar
similar to this.
and up on my month selection I want to insert the first day of the selected month in to database.
can you please help.
Hi, I'm having an issue with kendo charts. Basically I need to get both the cost and consumption y-axes on the chart to cross the category axis at 0. Kendo has .AxisCrossingValue() which looks like its supposed to fix this issue by setting the value however it doesn't seem to work when there is more than one y axis on a graph.
Here is the code im using:
@(Html.Kendo().Chart<PlotPoint>()
.Name("InvoiceChart")
.Legend(legend => legend.Position(ChartLegendPosition.Bottom).Visible(true))
.ChartArea(chartArea => chartArea.Background("transparent"))
.PlotArea(pa => pa.Background("#FFFFFF"))
.AutoBind(false)
.SeriesDefaults(x => x.Column().Labels(y => y.Visible(true).Format("{0:N0}").Background("transparent").Position(ChartBarLabelsPosition.InsideEnd).Rotation(90)))
.ValueAxis(axis => axis.Numeric().Name("cons").Title("Consumption").Labels(labels => labels.Format("{0:N0}")).AxisCrossingValue(0))
.ValueAxis(axis => axis.Numeric().Name("cost").Title("Cost £").Labels(labels => labels.Format("{0:N0}")).AxisCrossingValue(0))
.HtmlAttributes(new { style = "height:480px;" })
.CategoryAxis(axis => axis.Labels(x => x.Rotation(-45)).AxisCrossingValue(0, 1000))
.Events(x => x.LegendItemClick("OnChartLegendClickToHideShowSeriesData")))
And here is what the graph looks like when there are negative y axis values:
Any help would be greatly appreciated.
Thanks
i.Add()
.Id(Id.ToString())
.Name(Id.ToString())
.Title(Name.ToString())
.Field(Id.ToString())
.Label(l => l.Text(Lab + ":"))
.Editor(e =>
{
e.NumericTextBox<Decimal>()
.Format("c")
.Value(System.Convert.ToDecimal(Answer));
});
Posted above is an item on a form unfortunately the Value property doesn't display anything nor does hard coding a number into Value property. However, when I place the same variable into the placeholder property, it does seem to display what its supposed to. Is there a reported bug for why this is happening or perhaps a work around to assist this.
Thank you in advance for your assistance
Attempting to create persistence on filter.
I have the following filter:
@(Html.Kendo().Filter<...>()
.Name("fltMatrix")
.Events(e => e.Change("fltMatrix_Change"))
.DataSource("dataSource1")
.ExpressionPreview()
.Fields(f =>
{
...
}))
@Html.HiddenFor(model => model.FILTER)
I have the following JS code:
function fltMatrix_Change(e) {
e.sender.applyFilter();
$("#FILTER").val(JSON.stringify(e.expression));
}
function getInitialExpression() {
if ($("#FILTER").val()) {
return JSON.parse($("#FILTER").val());
}
}
document.ready looks like this:
$(document).ready(function () {
if (getInitialExpression()) {
var filter = $("#fltMatrix").data("kendoFilter");
console.log(filter);
var options = filter.getOptions();
options.expression = getInitialExpression();
filter.setOptions(options);
filter.applyFilter();
}
});
console shows undefined and I get an error on the highlighted line:
jQuery.Deferred exception: Cannot read properties of undefined (reading 'getOptions') TypeError: Cannot read properties of undefined (reading 'getOptions')
Everything else seems to work OK. The filter is loading and updating the data source on change. The filter expression makes the round trip to the server and back. It is just the .data("kendoFilter") that comes back with nothing.
We recently upgraded Telerik to 2024.3.806. Adding a reference to kendo.min.all.js to the Scripts file in the MVC project updated the styles in our grids, but the custom template no longer displays when clicking on a button for it from the grid.
Removing the reference to the new JS restores the functionality but breaks the styling, which makes it difficult for our users to navigate through the grid (control buttons are invisible until the user hovers over them; the new style fixes that issue). Is there anything wrong with this code as written? None of it has been changed.
@(Html.Kendo().Grid<ESGR.Icms.Core.Domain.QuickViewCasesDto>()
.Name("grid")
.Sortable()
.Pageable(pager =>
{
pager.Input(true);
pager.Info(true);
pager.Numeric(false);
pager.PreviousNext(true);
pager.PageSizes(new int[] { 25, 50, 100 });
})
.Columns(columns =>
{
columns.Bound(column => column.FirstName).Title("First Name").Media("(min-width: 768px)");
columns.Bound(column => column.LastName).Title("Last Name").Media("(min-width: 768px)");
columns.Bound(column => column.DateOpened).Title("Date Opened").Width(200).Format("{0:MM/dd/yyyy}").Media("(min-width: 768px)");
columns.Bound(column => column.CaseNumber).Title("Case Number").Width(120).Media("(min-width: 768px)");
columns.Bound(column => column.CaseStatus).Title("Status").Width(120).Media("(min-width: 768px)");
columns.Bound(column => column.CaseState).Title("State").Width(80).Media("(min-width: 768px)");
columns.Bound(column => column.CaseRegion).Title("Region").Width(100).Media("(min-width: 768px)");
columns.Bound(column => column.AssignedTo).Title("Assigned To").Width(120).Media("(min-width: 768px)");
columns.Bound(column => column.EnteredBy).Title("Entered By").Width(120).Media("(min-width: 768px)");
columns.Bound(column => column.LastUpdate).Title("Last Update").Width(130).Format("{0:MM/dd/yyyy}").Media("(min-width: 768px)");
columns.Bound(column => column.CaseIdentifier).Title("Case Identifier").Width(80).Media("(min-width: 768px)").Hidden();
columns.Bound(column => column.Employer).Title("Employer").Width(80).Media("(min-width: 768px)").Hidden();
columns.Bound(column => column.OmbudsmanFirstName).Title("OmbudsmanFirstName").Media("(min-width: 768px)").Hidden();
columns.Bound(column => column.OmbudsmanLastName).Title("OmbudsmanLastName").Media("(min-width: 768px)").Hidden();
columns.Group(group => group.Title("Action Required").Width(150).Columns(info =>
{
info.Bound(x => x.TwoDayRequired).Title("2 Day").Width(50);
info.Bound(x => x.SevenDayRequired).Title("7 Day").Width(50);
info.Bound(x => x.FourteenDayRequired).Title("14 Day").Width(56);
}).Media("(min-width: 768px)")
);
columns.Bound(column => column.CaseID).Width(40).ClientTemplate("<a class='k-button manage' aria-label='ManageCase' href='" +
@Url.Content("~/ManageCase") + "?caseId=#= CaseID #'" + ">ManageCase</a>").Sortable(false)
.Title("Manage Case").Width(100).Media("(min-width: 768px)");
columns.Template("#=resColTemplate(data)#").Title("Records").Media("(max-width: 768px)");
columns.Command(command => command.Custom("MoreInfo").Click("showDetails")).Title("More Info").Width(90).Media("(min-width: 768px)");
}).DataSource(ds => ds.Ajax()
.Read(r => r.Url(@Url.Content("~/QuickViewCases?handler=Read")).Data("forgeryToken").Data("StatusSelection"))
.Model(m => m.Id(id => id.CaseID))
.PageSize(25))
.Pageable()
)
@*ViewDetail Modal view*@
@(Html.Kendo().Window()
.Name("Details")
.Title("Case More Information")
.Visible(false)
.Modal(true)
.Resizable()
.Draggable(true)
.Width(500)
)
<script type="text/x-kendo-template" id="template">
<div>
<div class='viewdetails'>
<ul class="form-group p-3 mt-2">
<li><span class="b">Date Opened: </span>#= DateOpenedString #</li>
<li><span class="b">Ombudsman: </span>#= OmbudsmanFirstName # #= OmbudsmanLastName # </li>
<li><span class="b">Employer: </span>#= Employer #</li>
<li><span class="b">Primary Point of Contact First Name: </span>#= PriPocFirst #</li>
<li><span class="b">Primary Point of Contact Last Name: </span>#= PriPocLast #</li>
<li><span class="b">Email: </span>#= Email #</li>
<li><span class="b">State: </span>#= CaseState #</li>
<li><span class="b">Summary: </span>#= Summary #</li>
</ul>
</div>
</div>
</script>
<script>
var detailsTemplate;
$(document).ready(function() {
detailsTemplate = kendo.template($("#template").html());
});
//Open ViewDetail Window
function showDetails(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Details").data("kendoWindow");
wnd.content(detailsTemplate(dataItem));
wnd.center().open();
};
</script>
I am also including screenshots. In the browser tools I can see that the data does load in the template, but it does not display on the screen.
Any ideas?
Hi,
I have a kendo grid. On copy the records from excel and paste on the kendo grid Paste event is triggered.
Suppose I have pasted 50 records from the excel to the grid. From that 50 records 10 records are invalid and I want to validate and show the error message for each row by row.
Please let me know how we can validate row by row on paste these 50 records from excel to kendo grid.
Events(events => events.Paste("onPaste"))
function onPaste(e) { }
I know, it's a big leap but I was assigned this old application. Obviously, a lot of things have changed.
currently we are using:
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
string.Format("~/Scripts/kendo/{0}/jszip.min.js", KendoVersion),
string.Format("~/Scripts/kendo/{0}/kendo.all.min.js", KendoVersion),
string.Format("~/Scripts/kendo/{0}/kendo.aspnetmvc.min.js", KendoVersion)));
and
bundles.Add(new StyleBundle(string.Format("~/Content/kendo/{0}/css", KendoVersion)).Include(
string.Format("~/Content/kendo/{0}/kendo.common-bootstrap.min.css", KendoVersion),
string.Format("~/Content/kendo/{0}/kendo.custom.css", KendoVersion)))
I noticed none of the Content files are around anymore, or the jszip.min.js
Are there new files to replace these with?
I assume, even if there are, there will be code changes involved. correct?
I started out trying to update Bootstrap to the latest, but I don't think the 2017 version of kendo was playing well with it.
Thanks in advance.
I'm using the stepper and i don't want to display the progressbar animation since my page is reloading every 30 seconds, and it's anoying.
i tried a couple things like:
@(Html.Kendo().Stepper()
.Name("stepper")
.Animation(false) // Disable animation
.Steps(s =>
{
s.Add().Label("First Step");
s.Add().Label("Second Step").Selected(true);
s.Add().Label("Last Step").Icon("save");
})
)
also with css:
.k-stepper .k-stepper-content {
transition: none !important;
}
also with javascript:
$(document).ready(function() {
kendo.fx($("#stepper")).disable();
});
$(document).ready(function() {
var stepper = $("#stepper").data("kendoStepper");
stepper.options.animation = false;
});
Nothing is working.
i' trying to make it work in Telerik Dojo : Kendo UI Dojo
Any idea how to remove the animation?
I have a div tag which has all three controls within the tag
1. TabStrip as the main container
2. Panel bar inside the tab
3.Dropdown inside the panel bar.
But the code is giving me the error - Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.
Can somebody help me to resolve and fix it.
Below is my code structure
<div class="InputArea">Recently I upgraded Kendo in a project from a 2020 version to the current version. It seems CancelText() and UpdateText() etc. of the command column in a grid have changed and now perform html escaping on the value. This results in the html code being shown to the user instead of what was intended.
Is it possible (and how) to get the old behaviour back?
The intended use is to have just an icon (not from the kendo set) on the button and no further text. So setting the CancelIconClass to "none" and putting the icon's html snippet in the text, used the achieve the intended result. But this method doesn't work any more.