I'm using remote binding, but not appears arrow to expand node.
This is method
public
JsonResult Read_DropDownTreeNewCustomerCategoriesData(
string
Code)
{
var result = GetHierarchicalNewCustomerCategoryData()
.Where(x => !
string
.IsNullOrEmpty(Code) ? x.ParentCode == Code : x.ParentCode ==
null
)
.Select(item =>
new
{
Code = item.Code,
Name = item.Name,
hasChildren = item.HasChildren
});
return
Json(result.ToList());
}
This is control
@(Html.Kendo().DropDownListFor(model=>model.NewCustomerCategoryCode)
.DataTextField("Name")
.DataValueField("Code")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Read_DropDownTreeNewCustomerCategoriesData", "ListBox")
)
)
)
I attached result
I am trying to have a treelist with the new functionality and the drag&drop functionality.
I have enabled the drag&drop functionality but the treelist does not update the relationship after the drop ends.
On another post it was suggested to set Autosync on the datasource. However this creates the problem that when creating a new item it is automatically saved without the user been able to enter values first. This is not acceptable for my situation because there are some fields that are mandatory and I do not want to use a default value. So Autosync is out of the question.
On another post it was suggested to handle the DragEnd and call manually the sync on the datasource. However this is not handle as expected. Because my method sometimes should fail (The datasource error event is called). And after the error event is handled the treelist is in an incorect state since the dragged item is displayed with the wrong parent (In the Autosync if an error occured the drop would be canceled and the item returns to the initial position)
So my question is how can I have the two functionalities? (Autosync-ing only drag&drop and leave the create without autosync)
Hello,
I have scheduler that has editable events. When editing an event the template that i provide loads up another scheduler. The scheduler within the editor template needs to have it's date set to match the start date of the event i'm editing. So far i can get this working by using a custom binder to bind my date in the editor model to my scheduler.
EditorTemplate:
@(Html.Kendo().Scheduler<
TaskViewModel
>()
.Name("staffAvailability")
.Height(300)
.HtmlAttributes(new {data_bind = "bindDate:start, visible:Staff.length" })
.Timezone("Europe/London")
.Editable(false)
.AutoBind(false)
.Views(views =>
{
views.TimelineView(timeline =>
{
timeline.Footer(false);
});
})
.DataSource(dataSource => dataSource
.ServerOperation(true)
.Read(read => read.Action("ListStaffSessions", "Scheduler").Data("getStaffAttendance"))
).Events(e => e.DataBound("dataBoundAttendanceControl").DataBinding("dataBindingAttendanceControl"))
)
javascript:
kendo.data.binders.widget.bindDate = kendo.data.Binder.extend({
init: function (widget, bindings, options) {
kendo.data.Binder.fn.init.call(this, widget.element[0], bindings, options);
},
refresh: function () {
var that = this,
value = that.bindings["bindDate"].get()
var scheduler = $(that.element).data("kendoScheduler");
scheduler.date(value);
}
});
The issue i have is i don't want the scheduler to read from my data source on load, so i've specified that autoBind should be false on this scheduler however because i'm trying to bind the date this way that results in a change event being fired and my data source gets read.
Is there any way for me to provide the scheduler in my editor template a start date via the html helpers to avoid having to write a custom binder?
Hi,
I've created a grid to with i've added several dropdowns as editor controls I have added the relevant UIHints etc... and the drop downs are shoing and being populated correctly however when selecting a value from one of the dropdows I get an error that shows up in the console complaining that the property is null and when the model is passed through to the update method the values being passed are those of the original data and not the updated fields
This is my grid:
@(
Html.Kendo().Grid<
BookingHub.Areas.Admin.ViewModels.DriverTestTypeViewModel
>
()
.Name("DrivingTestTypesGrid")
.Columns(columns => {
columns.Bound(t => t.Name).Title("Category Name");
columns.Bound(t => t.Description).Title("Description");
columns.Bound(t => t.Duration).Title("Duration");
columns.Bound(t => t.StandardFee).Title("Standard Fee");
columns.Bound(t => t.PremiumFee).Title("Premium Fee");
columns.Bound(t => t.TheoryTestCode).Title("Theory Test Required")
.ClientTemplate("#= TheoryTestCode == null? '' : TheoryTestCode.Description #");
columns.Bound(t => t.FullTestRequired).Title("Full Test Required")
.ClientTemplate("#= FullTestRequired == null? '' : FullTestRequired.Category #");
columns.Command(command => {
command.Edit().Template("<
a
title
=
'Click to edit'
class
=
'k-button k-button-icontext btn btn-sm k-secondary k-grid-edit'
><
i
class
=
'fa fa-pencil-alt text-primary'
></
i
></
a
>");
command.Custom("UpdateFee").Click("").Template("<
a
title
=
'Click to edit'
class
=
'k-button k-button-icontext btn btn-sm k-secondary'
data-toggle
=
'modal'
><
i
class
=
'fa fa-pencil-alt text-primary'
></
i
></
a
>");
});
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.AutoSync(false)
.ServerOperation(false) //paging, sorting and grouping performed in the client
.Events(events => events.Error("GenericErrorHandler.handleCoreErrors('#DrivingTestTypesGrid')"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Name);
model.Field(t => t.Description);
model.Field(t => t.Duration);
model.Field(t => t.StandardFee);
model.Field(t => t.PremiumFee);
model.Field(t => t.TheoryTestCode);
model.Field(t => t.FullTestRequired).DefaultValue(ViewData["DriverTestTypesDefault"] as BookingHub.Areas.Admin.ViewModels.FullTestRequiredViewModel );
})
//.Create("CreateCustomerAccount", "View", new { Area = "Admin" })
.Read("GetDriverTestTypes", "DriverTestTypes", new { Area = "Admin" })//.Type(HttpVerbs.Post))
.Update("UpdateDriverTestType", "DriverTestTypes", new { Area = "Admin" })
//.Destroy("DeactivateCustomerAccount", "View", new { Area = "Admin" })
)
)
My View Model :
public
class
DriverTestTypeViewModel : GenericViewModel
{
[ScaffoldColumn(
false
)]
public
int
Id {
get
;
set
; }
[UIHint(
"TextArea"
)]
public
string
Description {
get
;
set
; }
public
int
Duration {
get
;
set
; }
[Display(Name =
"Start Date"
)]
public
DateTime StartDate {
get
;
set
; }
[Display(Name =
"End Date"
)]
public
DateTime? EndDate {
get
;
set
; }
[ScaffoldColumn(
false
)]
public
string
CreatedBy {
get
;
set
; }
[ScaffoldColumn(
false
)]
public
DateTime? CreatedOn {
get
;
set
; }
[ScaffoldColumn(
false
)]
public
string
UpdatedBy {
get
;
set
; }
[ScaffoldColumn(
false
)]
public
DateTime? UpdatedOn {
get
;
set
; }
public
string
Name {
get
;
set
; }
[DataType(DataType.Currency)]
public
decimal
StandardFee {
get
;
set
; }
[DataType(DataType.Currency)]
public
decimal
PremiumFee {
get
;
set
; }
[UIHint(
"TheoryTestCodeEditor"
)]
public
TheoryTestCodeViewModel? TheoryTestCode {
get
;
set
; }
[UIHint(
"FullTestRequiredEditor"
)]
public
FullTestRequiredViewModel? FullTestRequired {
get
;
set
; }
public
int
? TheoryTestTypeId {
get
;
set
; }
}
My editor controls (obviously in separate partial views named the same as the ui hint):
@(Html.Kendo().DropDownList()
.Name("FullTestRequired") // The name of the widget has to be the same as the name of the property.
.DataValueField("Id") // The value of the drop-down is taken from the TheoryTestCode Id property.
.DataTextField("Category") // The text of the items is taken from the TheoryTestCodes Description property.
.BindTo((System.Collections.IEnumerable)ViewData["DriverTestTypes"]) // A list of all TheoryTestCodes which is populated in the controller.
.AutoBind(false)
)
@(Html.Kendo().DropDownList()
.Name("TheoryTestCode") // The name of the widget has to be the same as the name of the property.
.DataValueField("Id") // The value of the drop-down is taken from the TheoryTestCode Id property.
.DataTextField("Description") // The text of the items is taken from the TheoryTestCodes Description property.
.BindTo((System.Collections.IEnumerable)ViewData["TheoryTestCodes"]) // A list of all TheoryTestCodes which is populated in the controller.
.AutoBind(false)
)
The following is where i populate the dropdowns :
public
async Task<ActionResult> Index()
{
ViewData[
"TheoryTestCodes"
] =
new
List<TheoryTestCodeViewModel> {
new
TheoryTestCodeViewModel { Description =
"MotorBike"
, Id = 2, TestCode = 2 },
new
TheoryTestCodeViewModel { Description =
"Car"
, Id = 1, TestCode = 1 }
};
ViewData[
"DriverTestTypes"
] =
new
List<FullTestRequiredViewModel>
{
new
FullTestRequiredViewModel { Category =
"A1 Off Road"
, Id = 2 },
new
FullTestRequiredViewModel { Category =
"Test"
, Id = 3 }
};
ViewData[
"DriverTestTypesDefault"
] =
new
List<FullTestRequiredViewModel>
{
new
FullTestRequiredViewModel { Category =
"A1 Off Road"
, Id = 2 }
};
return
this
.View(
"DriverTestType"
);
}
The console error that is displaying is "Uncaught TypeError: Cannot read property 'FullTestRequired' of null" which happen on the selection of an item from the dropdown
I can't see what is wrong so any assistance would be gratefully appreciated :)
When I add an editor to a form either directly or through the new wizard, it does not unmask the field. Please let me know what am I doing wrong.
...
item.Add()
.Field(field => field.Zip)
.Label(label => label.Text(
"Zip"
))
.Editor(editor => editor.MaskedTextBox().Mask(
"00000-9999"
).UnmaskOnPost());
...
I am trying to use either the new Form or Wizard widget as a popup editor, but it does not bind the data item to the widget.
Is this supported? Is there a way I can archive this?
Thanks
Didn't see this anywhere in the documentation. How exactly would I set up the toolbar with an Excel export options. I know with HtmlHelpers I would do
.ToolBar(tools => tools.Excel())
But i'm not seeing any way to do that with the TagHelpers <excel /> and <toolbar></toolbar>.
Thanks in advance.
Do you have any plans to port the Web Mail sample application from ASP.NET MVC to ASP.NET Core?
It's one of the more real world samples and it would be beneficial to see an implementation using the latest features such as Razor Pages.