Telerik Forums
UI for ASP.NET Core Forum
9 answers
66 views

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

Aleksandar
Telerik team
 answered on 27 Jul 2020
7 answers
74 views

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)

 

Tsvetomir
Telerik team
 answered on 23 Jul 2020
4 answers
377 views

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?

Aleksandar
Telerik team
 answered on 23 Jul 2020
2 answers
135 views

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 :) 

Tsvetomir
Telerik team
 answered on 23 Jul 2020
3 answers
295 views

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());
...
Aleksandar
Telerik team
 answered on 22 Jul 2020
1 answer
386 views

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

Aleksandar
Telerik team
 answered on 22 Jul 2020
6 answers
230 views
Hello, how are you?
I'm from Brazil, very pleased.

So, I want to press delete, delete also on my backend, not only on my client, I used the destroy method, but it only deletes on the client, it is not deleting from my DB, anyway, where am I wrong?

public IActionResult Delete(Guid? id, [DataSourceRequest] DataSourceRequest request)
        {
            try
            {
                var game = UnitOfWork.Game.Get(id);
                UnitOfWork.Game.Delete(game);
                UnitOfWork.SaveChanges();

                return Json(game, request);
            }
            catch (Exception e)
            {
                throw new ArgumentException(e.Message);
            }

        }

And now my Grid:

@(Html.Kendo().Grid<GameListViewModel>()
      .Name("Grid")
      .Columns(columns =>
      {
          columns.Bound(p => p.Name).Title("Nome");
          columns.Bound(p => p.Price).Title("Preço");
          columns.Bound(p => p.Description).Title("Descrição");
          columns.Bound(p => p.GenderName).Title("Categoria");
          columns.Command(c => c.Edit().HtmlAttributes(new {title = "Editar Item"})).Title("Editar");
          columns.Command(read => read.Destroy().HtmlAttributes(new {title = "Deletar item"})).Title("Deletar");
      })
      .Pageable()
      .Sortable()
      .Scrollable()
      .Filterable()
      .HtmlAttributes(new { style = "height:430px;" })
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(20)
          .Read(read => read.Action("TelerikGrid", "Game"))
          .Update(read => read.Action("Edit", "Game", new {id = "{0}"}))
          .Destroy(read => read.Action("Delete", "Game"))
      ))

Probably my call is not going to the controller, how can I resolve it? Thank you.
Tsvetomir
Telerik team
 answered on 21 Jul 2020
3 answers
54 views
     Can you share what features the image editor will have for ASP.Net Core in the R3 2020 release?  Will it be more than the crop and resize listed in the roadmap on your site?
Nencho
Telerik team
 answered on 21 Jul 2020
7 answers
354 views

     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.

Daniel
Top achievements
Rank 1
Iron
 answered on 20 Jul 2020
1 answer
228 views

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. 

Dimitar
Telerik team
 answered on 20 Jul 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?