I have a hierarchical grid, containing a list of records, with their associated actions.
When an action is inserted, the data repository will adjust the status of the master record, according to the action type that has been inserted. This works, however I'm having difficulty refreshing the master grid to reflect the change in status.
I have put a handler on the action grids (the sub grid) save event, however this fires before the database change has been saved, so the change to the master grids data isn't reflected?
What event can I handle to refresh the master grid once the data has been saved?
The code is:-
@(Html.Kendo().Grid<SimpleChangeControl.Models.View_Action>() .Name("ActionsGrid_#=ID#") .Events(e => e.Edit("onSubEdit")) .Columns(columns => { columns.Bound(o => o.ID).Title("ID"); columns.Bound(o => o.ActionType).Title("Type").ClientTemplate("<span>\\#=ActionTypeDescription\\#</span>").Filterable(f => f.UI("actionTypeFilter")); columns.Bound(o => o.Description).Title("Description"); columns.Command(command => { command.Edit(); command.Destroy(); }); }) .Filterable(f => f .Extra(false) .Operators(o => o .ForNumber(str => str.Clear() .IsEqualTo("Equals")))) .ToolBar(commands => commands.Create()) .Editable(editable => editable .Mode(GridEditMode.PopUp)) .DataSource(dataSource => dataSource .Ajax() .Events(e => e.Error(@<text> function(e){subError(e,"ActionsGrid_#=ID#")} </text>)) .Model(m => m.Id(p => p.ID)) .PageSize(10) .Read(read => read.Action("RD_Actions", "ChangeRequests", new { ChangeRequestID = "#= ID #" })) .Create(create => create.Action("InsertAction", "ChangeRequests", new { CRID = "#= ID #" })) .Update(update => update.Action("UpdateAction", "ChangeRequests")) .Destroy(delete => delete.Action("DeleteAction", "ChangeRequests")) ) .Filterable() .Events(e=>e.Save("actionSave")) .Pageable(p => p.Refresh(true)) .ToClientTemplate())The handler is:-
function actionSave() { var grid = $('#Grid').data("kendoGrid"); grid.dataSource.read(); }
I have a grid defined thusly:
@Model VendorManagement.Web.Models.RiskExposureViewModel
@using Kendo.Mvc.UI
@(Html.Kendo().Grid(Model.RiskMatrixExposureList)
.Name("grdRiskMatrix")
.Columns(columns =>
{
columns.Bound(c => c.RiskUnit).Title("Risk Unit");
columns.Bound(c => c.RiskCategory).Title("Risk Category");
columns.Bound(c => c.RiskDescription).Title("Short Description");
})
.Read(read => read.Action("BindRiskMatrixGrid", "Risk"))
.Pageable()
)
RiskMatrixExposureList is a List<RiskMatrixExposure>. The grid as defined is throwing the following error in Razor:
"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type"
I have the namespace defined in Views/web.config:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="VendorManagement.Web" />
<add namespace="Kendo.Mvc.UI" />
</namespaces>
</pages>
</system.web.webPages.razor>
Thanks for they help!
I have a Target field in my PopupEditor that's using custom List to display a dropdown in the View. I want the first item in the custom list (Self) to show as the default value in the dropdown.
View:
@Html.LabelFor(model => model.Target, new { @class = "col-sm-5 control-label" })<div> @Html.EditorFor(model => model.Target)</div>Controller:
public ActionResult Index(){ ViewData["Targets"] = ixList.Targets(); return View();}Custom List (ixList):
public static List<TargetsModel> Targets(){ List<TargetsModel> targets = new List<TargetsModel>(); targets.Add(new TargetsModel { Description = "Self", Target = "_self" }); targets.Add(new TargetsModel { Description = "Blank", Target = "_blank" }); return targets;}Model:
[UIHint("GridForeignKey")]public string Target { get; set; } // target = _blank, _self
How would I go about setting the first item Self to the default value? Right now the default value appears to be null.
I have an ID and status for every job and I need to grab that ID and status when I double click on the job. Is it possible to set attributes for the job ID and status and then catch those with jQuery?
Thanks in advance.
@(Html.Kendo().Grid<Inspection>() .Name("grid") .DataSource(dataSource => dataSource.Ajax() .Model(model => { model.Id(p => p.ID); model.Field(p => p.Date); model.Field(p => p.TypeID); }) .Read(read => read.Action("grid_Read", "Grid", new { ID = Model.ID })) .Update(update => update.Action("grid_Update", "Grid", new { ID = Model.ID })) .PageSize(10)) .Columns(columns => { columns.Bound(c => c.RequestedDate).Format("{0:d}").EditorTemplateName("_DateTime").Width(200); columns.ForeignKey(c => c.TypeID, (System.Collections.IEnumerable)ViewBag.Types, "TypeID", "TypeName").Title("Test Types"); columns.Command(command => { command.Edit(); }); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable(pageable => pageable.Messages(messages => messages.Empty("Nothing Here"))) .Sortable(sortable => sortable.AllowUnsort(false)) )ViewBag.Types = _service.Repository.InspectionTypes;Hi,
I need to be able to show some notifications that auto hide after 5 seconds and others that don't auto hide. I am achieving this by using this code when I want to show a notification for 5 seconds:
01.var fadingnotification = $("#fadingnotification").kendoNotification({02. position: {03. pinned: true,04. bottom: 60,05. right: 3006. },07. stacking: "up",08. autoHideAfter: 5000,09. templates: [{10. type: "stickyinfonodismiss",11. template: $("#stickyInfoNoDismissTemplate").html()12. }, {13. type: "stickyinfo",14. template: $("#stickyInfoTemplate").html()15. }, {16. type: "info",17. template: $("#infoTemplate").html()18. }]19.}).data("kendoNotification");20. 21.fadingnotification.show({22. message: msgToDisplay23.}, "info");and using the same code but with "autoHideAfter: 0" for the ones that I want to display without hiding.
The problem I have is that this effectively initiates a new notification GUID each time so the notifications start again at the bottom of the screen each time even if there are already notifications on screen.
Ideally I want to just change the autoHideAfter option without initialising a new notification and therefore a new GUID.
Any ideas?
Thanks,
Mark.
I've following grid with inline edit. For selecting date and time they have their respective date and time controls. I want to post date in '12-Sep-2015 12.00.00' format and time in '09:00:00' format to mvc control action. But when I post the data, date is in the 'Wed Sep 23 2015 00:00:00 GMT-0400 (Eastern Daylight Time)' format. Time is in the 'Sat Sep 19 2015 15:00:00 GMT-0400 (Eastern Daylight Time)' format. This only happens if I change date and time value. If I don't change, values are posted the way I want to. What do I do to post data in proper format after edit?
@(Html.Kendo().Grid<Kyklos.ClinicPortal.ViewModels.AppointmentViewModel>()
.Name("UpCmgApptGrid").
Columns(columns =>
{
columns.Bound(c => c.strAppintmentDate).Title("Appintment Date").Format("{0:MM/dd/yyyy}").EditorTemplateName("Date");
columns.Bound(c => c.strAppintmentTime).Title("Appintment Time").Format("{0:hh:mm tt}").EditorTemplateName("Time");
columns.Bound(c => c.DoctorName).Title("Doctor");
columns.Command(command => { command.Edit(); }).Title("Edit").Width(250);
columns.Command(command => { command.Destroy(); }).Title("Delete").Width(150);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.Events(events => events.Cancel("onCancel"))
.DataSource(
dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(a => a.PatAppointment.AppointmentId);
model.Field(a => a.DoctorName).Editable(false);
})
.Read("UpcomingAppointment_Read", "Appointment", new { PatientId = Model.PatAppointment.PatientId })
.Update(update => update.Action("UpcomingAppointment_Update", "Appointment"))
.Destroy(update => update.Action("UpcomingAppointment_Destroy", "Appointment"))
)
)​
Hi I have problem with export diagram to SVG.
I get error message:
This page contains the following errors: error on line 1 at column 3494: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.​
I tried kendo version 2015.2.624 and v2015.2.902. The result is the same.
I tried this code:
$("#exportSvg").click(function () {
var diagram = $("#diagram").getKendoDiagram();
diagram.exportSVG().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "diagram.svg"
});
});
});
and this code with proxyURL:
$("#exportSvg").click(function () {
var diagram = $("#diagram").getKendoDiagram();
diagram.exportSVG().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "diagram.svg",
proxyURL: "<%= Url.Action("ExportSave", "OrganizacneSchemy") %>"
});
});
});​
Where is the problem ?
Thanks
I am adding MVC & Telerik Kendo to legacy webforms application.
I have only just added MVC 5 itself to the project using an MVC area. (see http://www.davepaquette.com/archive/2013/12/30/so-you-inherited-an-asp-net-web-forms-application.aspx).
To add Telerik MVC, I am following the steps here: http://docs.telerik.com/kendo-ui/aspnet-mvc/asp-net-mvc-5
When I get to the step adding @(Html.Kendo().DatePicker().Name("datepicker")) to a "hello world" mvc, and try to access it, I get a "System.EntryPointNotFoundException".
Any ideas what could be wrong?
Additional info:
I made the web.config changes to (and only to) the web.config file in the MVC area.
The "~/Content/kendo/..." and "~/Scripts/kendo/..." are in their standard places, not in the MVC area. Not sure if this matters, but no errors appear to be generated by the telerik bundles in BundleConfig.vb.
Googling I have found mentions of <bindingredirects> in the web.config, but the Telerik instructions I am following to not mention this possibility.
Hi,
I need to bind the datasource to ASP.NET MVC Scheduler dynamically. In my scenario, I have 5 dropdownlists. Users will select item from the dropdownlists and then click Search buton and the scheduler will load the result. How can I do that with javascript?
Please see the attached image.
@(Html.Kendo().Scheduler<TaskViewModel>() .Name("schedulerJob") .Date(new DateTime(2015, 8, 31)) .StartTime(new DateTime(2015, 8, 31, 7, 00, 00)) .Height(600) .Views(views => { views.TimelineView(); }) .Timezone("Etc/UTC") .Group(group => group.Resources("Techs").Orientation(SchedulerGroupOrientation.Vertical)) .Resources(resource => { resource.Add(m => m.TechName) .Title("Techs") .Name("Techs") .DataTextField("emm_code") .DataValueField("emm_code") .DataSource(d => d.Read("Techs", "JOBS")); }) .DataSource(d => d .Model(m => { m.Id(r => r.emm_code); }) .Read("JobSchedule_Read", "JOBS") .Create("JobSchedule_Create", "JOBS") .Update("JobSchedule_Update", "JOBS") .Destroy("JobSchedule_Delete", "JOBS") ))
public JsonResult JobSchedule_Read([DataSourceRequest] DataSourceRequest request){ DateTime startDateTime; DateTime endDateTime; List<JscDet> JscDet = (List<JscDet>)Session["JobScheduleDateTime"]; List<TaskViewModel> tasks = new List<TaskViewModel>(); foreach (var item in JscDet) { startDateTime = SchedulerUtility.GetDateTimeFromSeconds(item.jsd_sch_date, item.jsd_sch_start_time); endDateTime = SchedulerUtility.GetDateTimeFromSeconds(item.jsd_sch_date, item.jsd_sch_end_time); tasks.Add(new TaskViewModel() { TaskID = item.jsd_jobno, TechName = item.jsd_sch_assto, emm_code = item.jsd_sch_assto, Title = "Job Title", Start = new DateTime(startDateTime.Year, startDateTime.Month, startDateTime.Day, startDateTime.Hour, startDateTime.Minute, startDateTime.Second), End = new DateTime(endDateTime.Year, endDateTime.Month, endDateTime.Day, endDateTime.Hour, endDateTime.Minute, endDateTime.Second), Description = "Description 101", IsAllDay = false }); } return Json(tasks.ToDataSourceResult(request));}​
Thanks in advance