Telerik Forums
UI for ASP.NET Core Forum
1 answer
88 views

     I have a grid that is defined as such:

@(Html.Kendo().Grid<JohnstonePortal.Data.Entities.Announcement>()
                    .ToolBar(tools =>
                    {
                        tools.Create();
                    })
                   .Name("grdAnnouncements")
                   .AutoBind(true)
                   .Events(x=> x.Edit("onEdit"))                       
                    .ToolBar(tools =>
                    {
                        tools.Search();
                    })
                   .Columns(columns =>
                   {
                       columns.Bound(c => c.Text).Width(500).Title("Announcements");
                       columns.Command(command =>
                       {
                           command.Edit();
                           command.Destroy();
                       }).Width(250);
                   })
                 .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_EditAnnouncement"))
                .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model=>
                {
                model.Id(ann => ann.Id);
                })
                .Read(read => read.Action("AnnouncementsRead", "Announcements"))
                .Create(create => create.Action("AddAnnouncement", "Announcements"))
                .Update(update => update.Action("UpdateAnnouncement", "Announcements"))
                .Destroy(destroy => destroy.Action("DeleteAnnouncement", "Announcements"))
                ))

 

and the controller is defined as:

public IActionResult AddAnnouncement([DataSourceRequest]DataSourceRequest request, Announcement announcement)
     {
         if (ModelState.IsValid)
         {
             _db.Add<Announcement>
                 (new Announcement
                 {
                     DateCreated= DateTime.Now,
                     Text = announcement.Text
                 });            
             _db.SaveChanges();
         }
 
         // Return a collection which contains only the newly created item and any validation errors.
         return Json(new[] { announcement }.ToDataSourceResult(request, ModelState));
     }
 
     public IActionResult UpdateAnnouncement([DataSourceRequest]DataSourceRequest request, Announcement announcement)
     {
         if (ModelState.IsValid)
         {
             var editAnnouncement = _db.Announcements.Single(x => x.Id == announcement.Id);
             editAnnouncement.Text = announcement.Text;
             _db.SaveChanges();
         }
 
         // Return a collection which contains only the updated item and any validation errors.
         return Json(new[] { announcement }.ToDataSourceResult(request, ModelState));
     }

 

The odd thing is, if I update a row when the page loads, it behaves as normal but if I create one and then update another one, It calls the add endpoint first with the original model that was passed the first time to it and then calls the update on the new model that was intended. This obviously results in a duplicate of the first item that was created. I am not sure what I am doing incorrectly here.

Tsvetomir
Telerik team
 answered on 07 Nov 2019
2 answers
59 views

Really liking what I see so far.  Ok, so one of the first things ill need to do on this next project is display 3 different formatted lists, where the items are populated from a list of objects.  See attached screenshot.  Basically, I need to load the first list, which is used to make a selection to populate the 2nd and likewise the 3rd.  Actually the 3rd "list" wont be a list, but a detail grid.  Each step should not refresh the whole page, but just update the next portion, eg. partial page updates.  Hope that is clear.

What sets of components could be used in this approach?

Possibly use a PanelBar for the leftmost list, as well as the 2nd?
https://demos.telerik.com/aspnet-core/panelbar/index

However, for the lists themselves, on a previous project that used the UI for Angular library, I think I simply used Bootstrap listgroups
What library component could replicate this?
https://getbootstrap.com/docs/4.0/components/list-group/

The grid should be straighforward, but should it go in a panel

 

 

 

Martin
Telerik team
 answered on 06 Nov 2019
1 answer
263 views

Hello, 
I checked kendo version 2018.02.620 with Core 2.2 and Core 3.
in the first case, the app works successfully
in the second case, the app does not work.
Have you a plan to release a fix in order apps to work with kendo version 2018.02.620 and Core 3?

Thanks in advance for your answer.

Ivan Danchev
Telerik team
 answered on 06 Nov 2019
1 answer
51 views

No not by me :)

See attached screenshot.  The last few days Ive noticed several posts that are obviously spam promotting various sales gimmicks etc.

 

Rumen
Telerik team
 answered on 05 Nov 2019
1 answer
44 views

I just installed the Telerik UI for ASP.Net Core VS extension and when I start a new project, I get 3 options of the same thing?

 

Vesko
Telerik team
 answered on 05 Nov 2019
2 answers
80 views

how to validate the required field

which i define it the class as Required 

        example 
        [Required]
        public string Title { get; set; }
        [Required]
        public string Description { get; set; }

when i create new Record in grid asp.net Core

then i press Save button directly catch the controller with out any validation 

there is event in the grid 

.Events(e => e.Error("error"))

<script>
    function error(e) {

        console.log(e);
        if (e.errors) {
            var message = "Errors: \n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    };

</script>
any help please 

 

 

 

 

 

Alex Hajigeorgieva
Telerik team
 answered on 05 Nov 2019
1 answer
820 views

Hi,
is it possible to generate barcodes on the server side in .NET Core? I need generate a barcode image as base64 string.

Thanks,
MT

Alex Hajigeorgieva
Telerik team
 answered on 01 Nov 2019
4 answers
158 views

Hi,

I am trying to add an area of best fit to a standard scatter plot: I have one set of data points, and two equations for lines of best fit. The desired result is a scatter plot of the data points with a shaded area between the two lines of best fit.

I understand that it is currently not possible to mix categorical and XY charts (https://www.telerik.com/forums/using-area-and-scatter-chart-types-in-one-chart). I have tried drawing the desired area on the scatter chart as per https://docs.telerik.com/kendo-ui/controls/charts/how-to/appearance/draw-on-scatter-plots, however this results in the area being superimposed on the chart surface and prevents user interaction with the data points (tool-tips etc.) so is not an acceptable solution.

Is there any other way to achieve the desired result? Please see attached for a simplified example of what I'm trying to achieve.

David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 01 Nov 2019
1 answer
94 views

Hello,

I have a shared datasource that returns a model that has four lists

Model:

public class BillModel : DocumentBaseModel

{

         ...

        public List<HistoryModel> History { get; set; }
        public List<AmendmentModel> Amendments { get; set; }
        public List<OtherDocModel> OtherDocs { get; set; }
        public List<PreviousVersionModel> PreviousVersions { get; set; }

}

Shared Datasource:

             @(Html.Kendo().DataSource<BillModel>()
                       .Name("myDataSource")
                       .Custom(dataSource =>
                       {
                           dataSource
                           .Type("json")
                           .Transport(transport =>
                           {
                               transport.Read(read =>
                               {
                                   read.Action("GetBill", "Bills", new { billNo = "#=Id#" });
                               });
                           });
                       })
                 )

And one of my DDLs:

@(Html.Kendo().DropDownList()
                        .Name("amendments")
                        .DataTextField("Name")
                        .DataValueField("LFID")
                        .DataSource("myDataSource")
                        .HtmlAttributes(new { style = "width: 100%" })
                     .ToClientTemplate()
                 )

Plamen
Telerik team
 answered on 31 Oct 2019
1 answer
297 views

Hello,
I have a model with a few lists.  I am trying to use a shared datasource to populate a dropdownlist for each of these lists but I am having trouble with how to refer to a specific subobject within the object that is returned from the controller.  I’m sure that this has been done before… I’m just having trouble finding an example.

My model looks like this:
public class BillModel : DocumentBaseModel
    {
        …

        public List<HistoryModel> History { get; set; }
        public List<AmendmentModel> Amendments { get; set; }
        public List<OtherDocModel> OtherDocs { get; set; }
        public List<PreviousVersionModel> PreviousVersions { get; set; }
    }

My controller returns the BillModel
My view has a grid that accesses a ClientTemplate that has three ddls and my shared datasource.
@(Html.Kendo().DataSource<BillModel>()
.Name("myDataSource")
       .Custom(dataSource =>
       {
              dataSource
                     .Type("json")
                     .Transport(transport =>
                     {
                           transport.Read(read =>
                           {
                              read.Action("GetBill", "Bills", new { billNo = "#=Id#"});
                            });
                     });
       })
)
@(Html.Kendo().DropDownList()
.Name("amendments")
       .DataTextField("Name")
       .DataValueField("LFID")
       .DataSource("myDataSource")
       .HtmlAttributes(new { style = "width: 100%" })
  .ToClientTemplate()
)

@(Html.Kendo().DropDownList()
.Name("others")
       .DataTextField("Name")
       .DataValueField("LFID")
       .DataSource("myDataSource")
       .HtmlAttributes(new { style = "width: 100%" })
  .ToClientTemplate()
)

@(Html.Kendo().DropDownList()
.Name("previous")
       .DataTextField("Name")
       .DataValueField("LFID")
       .DataSource("myDataSource")
       .HtmlAttributes(new { style = "width: 100%" })
  .ToClientTemplate()
)

How do I get each ddl to use their list from the datasource?  I thought perhaps I could use dot notation and write .DataTextField(“Amendments.Name”).  It didn’t yell at me it just said undefined.  I’m sure it must be something simple I just can’t figure it out today.

Plamen
Telerik team
 answered on 31 Oct 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?