Telerik Forums
UI for ASP.NET Core Forum
1 answer
106 views
I would like to ensure that no trace of the PDF is saved to the local machine in any kind of cache etc.
Is this how the PDFViewer works?
Stoyan
Telerik team
 answered on 30 Jan 2024
1 answer
70 views

Hi,

on your demo page for ASP.NET Core MultiColumnComboBox Server Filtering when I enter Ali, then a request is sent to the server with querystring text=Ali and two records are shown.

When I click on one of the records and then expand the combox box again using the down arrow, then another request is send to the server but with empty text, so all records are returned.

This is problem when server contains a lot of records.

Is there a way how to send to the server the text shown in the input field? I need it to show just the one record like if I just entered the text in the field manually.

Regards,

Petr

Anton Mironov
Telerik team
 answered on 23 Jan 2024
1 answer
201 views

 im attempting to have a grid update based on records in a DB

i have a log4net service sending messages to a DB

i keep getting an error 

Uncaught (in promise) Objectmessage: "The message port closed before a response was received."[[Prototype]]: Object
BatchInsights:59 Uncaught ReferenceError: hub is not defined
    at HTMLDocument.<anonymous> (BatchInsights:59:1560)
    at i (jquery.min.js:2:27466)
    at Object.fireWith [as resolveWith] (jquery.min.js:2:28230)
    at Function.ready (jquery.min.js:2:30023)
    at HTMLDocument.K (jquery.min.js:2:30385)
jquery.simulate.js:331 Uncaught ReferenceError: jQuery is not defined
    at jquery.simulate.js:331:5

I followed the demo and still get this error ...here is the view

@model IEnumerable<FMM.Core.DataModel.Pharmpix.LogModel>
@using Kendo.Mvc.UI;
@using Kendo.Mvc.Extensions;
@using FMM.Core.DataModel.Pharmpix;

@{
    ViewData["Title"] = $"Batch Insights Logs";
    Layout = "~/Views/Shared/_Layout.cshtml";


}


<div>
    @(Html.Kendo().Notification()
        .Name("notification")
        .Width("100%")
        .Position(position => position
        .Top(50)
        .Left(50))
        )

   @(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.Id);
            columns.Bound(p => p.Logger).Width(150);
            columns.Bound(p => p.Message).Width(120).Filterable(false);

        })
        .ToolBar(toolbar =>
        {
            toolbar.Search();
        })
        .Groupable()
        .Pageable()
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .Scrollable()
        .HtmlAttributes(new { style = "height:100%;" })
        .DataSource(dataSource => dataSource
            .SignalR()
            .AutoSync(true)
            .PageSize(20)
            .Transport(tr => tr
                .Promise("hubStart")
                .Hub("hub")
                .Client(c => c
                    .Read("read")
                    )
                .Server(s => s
                    .Read("read")
               ))
                .Schema(schema => schema
                .Model(model =>
                {
                    model.Id("Id");
                    model.Field("Logger", typeof(string)).Editable(false);
                    model.Field("Message", typeof(string));

                })
            )
        ))



</div>


<script src="https://unpkg.com/@@aspnet/signalr@1.0.0/dist/browser/signalr.js"></script>
<script>
    $(document).ready(function () {
        var hubUrl = "logHub";
        var hub = new signalR.HubConnectionBuilder()
            .withUrl(hubUrl, {
                transport: signalR.HttpTransportType.LongPolling
            })
            .build();

        var hubStart = hub.start();
    });

    function onPush(e) {
        var notification = $("#notification").data("kendoNotification");
        notification.success(e.type);
    }
</script>

 

here is the hub

using FMM.Core.DataModel.Pharmpix;
using FMM.Core.Interfaces;
using FMM.DataAccess;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Financial_Management_Module.Hubs
{
    public class LogHub : Hub
    {
        private readonly PharmpixDbContext _context;
        private readonly IConfiguration _configuration;
        private readonly ILogging _log;

        public LogHub(PharmpixDbContext context, IConfiguration configuration, ILogging log)
        {
            _context = context;
            _configuration = configuration;
            _log = log;

        }



        public override System.Threading.Tasks.Task OnConnectedAsync()
        {
            Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnConnectedAsync();
        }

        public override System.Threading.Tasks.Task OnDisconnectedAsync(Exception e)
        {
            Groups.RemoveFromGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnDisconnectedAsync(e);
        }


        public IEnumerable<LogModel> Read()
        {
            var result = _context.LogModel.Select(i => new LogModel
            {
                Id = i.Id,
                Logger = i.Logger,
                Message = i.Message
            }
            
            ).ToList();


            return result;

        }



        public string GetGroupName()
        {
            return GetRemoteIpAddress();
        }

        public string GetRemoteIpAddress()
        {
            return Context.GetHttpContext()?.Connection.RemoteIpAddress.ToString();
        }



    }
}

 

here is the log hub 

 

using FMM.Core.DataModel.Pharmpix;
using FMM.Core.Interfaces;
using FMM.DataAccess;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Financial_Management_Module.Hubs
{
    public class LogHub : Hub
    {
        private readonly PharmpixDbContext _context;
        private readonly IConfiguration _configuration;
        private readonly ILogging _log;

        public LogHub(PharmpixDbContext context, IConfiguration configuration, ILogging log)
        {
            _context = context;
            _configuration = configuration;
            _log = log;

        }



        public override System.Threading.Tasks.Task OnConnectedAsync()
        {
            Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnConnectedAsync();
        }

        public override System.Threading.Tasks.Task OnDisconnectedAsync(Exception e)
        {
            Groups.RemoveFromGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnDisconnectedAsync(e);
        }


        public IEnumerable<LogModel> Read()
        {
            var result = _context.LogModel.Select(i => new LogModel
            {
                Id = i.Id,
                Logger = i.Logger,
                Message = i.Message
            }
            
            ).ToList();


            return result;

        }



        public string GetGroupName()
        {
            return GetRemoteIpAddress();
        }

        public string GetRemoteIpAddress()
        {
            return Context.GetHttpContext()?.Connection.RemoteIpAddress.ToString();
        }



    }
}

the code gets called if i comment out the "signal" stuff but when new entries are inserted it doesnt up date the the grid any help is appreciated!

 

                                              
Stoyan
Telerik team
 answered on 17 Jan 2024
1 answer
150 views

Razor code-behind method: I made the razor method as simple as possible, just to see if we could get in there / or hit onpostUploadFile
        public async Task<ActionResult> OnPostUploadFile(IEnumerable<IFormFile> files, string metaData)
        {
            AllowedExtensions = new string[] { "fpd", "pdf" };

            return Page();
        }

Razor page :

@addTagHelper *, Kendo.Mvc
<div>
    <div class="demo-section">
        <kendo-upload name="files">
            <async auto-upload="true" save-url="@Url.Action("Upload","UploadFile")" chunk-size="11000" />
            <validation max-file-size="20000000" />
        </kendo-upload>
    </div>
</div>

The issue is i am not able to hit the hander from the razor page when i pass the url to <async save-url="">, Despite many efforts, the handler specified in the save-url attribute doesn't seem to be hit and returns 404.

Not Working: 

1. save-url: "/Upload/UploadFile",

2. save-url="./Upload?handler=UploadFile"

I also found Forum where it discussed the same problem but that didn't help us :https://www.telerik.com/forums/upload-using-tag-helpers

 

Mihaela
Telerik team
 answered on 17 Jan 2024
1 answer
342 views
Hello,

I'm looking to see if its possible to have the validation on one item in a form be dependent on another inputs selection.


.
.
.
        @(Html.Kendo().Form<EquipmentViewModel>()
            .Name("EquipmentForm")
            .Layout("grid")
            .Items(items =>
            {
                items.AddGroup()
                    .Label("Registration Form")
                    .Items(i =>
                    {
                        i.Add()
                            .Field(f => f.EquipmentType)
                            .Label(l => l.Text("Equipment Type"))
                            .Editor(e =>
                            {
                                e.DropDownList()
                                    .DataTextField("ShortName")
                                    .DataValueField("EquipmentTypeID")
                                    .OptionLabel("Select")
                                    .DataSource(source =>
                                    {
                                        source
                                            .ServerFiltering(true)
                                            .Read(read => { read.Url("/Equipment/Index?handler=EquipmentTypesByEquipmentClassID").Data("EquipmentClassData"); });
                                    })
                                    .Enable(isControlEnabled)
                                    .Events(e => { e.Change("OnChangeEquipmentTypeChange").DataBound("OnChangeEquipmentTypeChange"); })
                                    .CascadeFrom("EquipmentClass");
                            });
                        i.Add()
                            .Field(f => f.EquipmentDesign)
                            .Label(l => l.Text("Equipment Design"))
                            .Editor(e =>
                            {
                                e.DropDownList()
                                    .DataTextField("ShortName")
                                    .DataValueField("EquipmentDesignID")
                                    .OptionLabel("Select")
                                    .DataSource(source =>
                                    {
                                        source
                                            .ServerFiltering(true)
                                            .Read(read => { read.Url("/Equipment/Index?handler=EquipmentDesignByEquipmentTypeID").Data("EquipmentTypeData"); });
                                    })
                                    .CascadeFrom("EquipmentType")
                                    .Enable(false)
                                    .Events(e => { e.Change("OnChangeEquipmentDesignChange").DataBound("OnChangeEquipmentDesignChange"); });
                            });
.
.
.

This scenario loads EquipmentDesigns based on the EquipmentType the user has selected. I would like EquipmentDesigns to be required ONLY if the selected equipment type has equipment designs. In other words, only when the call to get the EquipmentDesigns actually returns data.
Mihaela
Telerik team
 answered on 16 Jan 2024
1 answer
75 views

excute me, when i use kendo grid detailtemplate feature, i have some trouble. how can i fix it?

my source:

<div class="panel-collapse collapse show" id="collapse1" aria-expanded="true">
        @(
Html.Kendo().Grid(Model.UserRoleList.Value)
    .Name("gridRoles")
    .Scrollable()
    .Columns(columns =>
    {
        columns.Bound(c => c.RoleName).Width(130);
    })
    .Height(250)
    .DataSource(d => d.Custom()
                    .Type("aspnetmvc-ajax")
                    .Transport(t => t.Read(r => r.Url($"{_config.Value.AuthSettings?.ApplicationName ?? ""}/SystemManagement/UserPermission/View?handler=Paged&userId={Model.UserInfo.UserId}")))
                    .Batch(true)
                    .Schema(s => s.Model(
                        m => {
                            m.Id(p => p.RoleCode);
                        }
                    ).Data("Data"))
    )
    .ClientDetailTemplateId("templateGrp")
    .Deferred()
)

        <script id="templateGrp" type="text/x-kendo-template">
            <div>RoleCode: 123</div>
        </script>

        <script nonce="@_config.Value.AppSettings.CspNonce">
            @Html.Kendo().DeferredScripts(false);
        </script>

 

 

and feedback error:

Error: Invalid template:'
            <div>RoleCode: 123<//div>
        ' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput='\n            <div>RoleCode: 123<//div>\n        ';}return $kendoOutput;'
Anton Mironov
Telerik team
 answered on 15 Jan 2024
2 answers
148 views

Hi,

Looks like there is some kind of issue when trying to use the .NET Core wrapper for NumericTextBoxFor while using the culture pt-BR.

The values in the text field gets incorrect if the value has a decimal.

For example a double 1234.56 becomes 123,456.00 but the expected result is 1.234,56



This happens when the kendo.culture().numberFormat[","]  is a "." (dot).

Here is an example of the error:
https://netcorerepl.telerik.com/weavadPV01xSQZX716

I can also reproduce the error with Kendo UI jQuery, If the html input tag has an intital value, then it becomes like the example above.
https://dojo.telerik.com/@douglas.nordfeldt@nefab.com/ejEhecIV/2
https://dojo.telerik.com/@douglas.nordfeldt@nefab.com/ogiVoMAZ/5


Managed in my examples to do a work around until this has been fixed.

Douglas
Top achievements
Rank 1
Iron
 answered on 10 Jan 2024
1 answer
142 views

I have a column chart that has a default font of Arial. Is it possible to change this to the Inter font in one place or does the font have to be set for each individual label (e.g. chart title, axis title, axis label, legend, tooltip, etc.)?

Thanks,

Tim

Alexander
Telerik team
 answered on 09 Jan 2024
1 answer
101 views

My solution layout follows this:

  • Data - EF entities and DB Context
  • Services - Service objects that interact with the database (references the Data project directly)
  • Web - Front end (controllers and views) that use the Services project to push/pull data and reflect it back to the user

I recently discovered the ExpressionBuilder to handle grid filtering and convert it to LINQ to use in my Service objects to (efficiently) query the database (pushes the filter down to the DB query) so only a limited number of records are returned (thus, loaded into memory) instead of loading all records and then filtering them in memory.

My question, is there a similar object for Sorting functionality?  So it can convert my Grid Sort (from the DataSourceRequest object) into a LINQ OrderBy expression and apply it against my entity type so it can be passed into the DB query?  Or am I stuck writing my own?

Mihaela
Telerik team
 answered on 03 Jan 2024
1 answer
91 views

I'm trying to enable rapid entry using mostly just the keyboard using a DateTimePicker field.  The behavior is seeking to minimize the number of keystrokes to enter a date and time "close" to today. With a full date and time, they would need to type 14 keystrokes minimum based on the formats below.

The users would like to do this:

  1. Alt-down to open date picker on today (1 keystroke)
  2. Use arrow keys to find the right date (1-4 keystrokes avg)
  3. Hit enter to close the date picker -- (this is where the problem starts) (1 keystroke)
  4. Type in 4 numbers to represent time. (4 keystrokes)
  5. Hit enter - done (would go to the next field ideally - could hit tab as alternative)

Generally 9 keystrokes (sometimes less) instead of 14 every time.

The code below is what I've been trying to get to work.  It can run in the REPL playground - and I'm happy to use any of the events to achieve the desired behavior.  I haven't been able to get the above set of keystrokes to work with any combination of code / etc that I've tried so far.

Any chance you could help?  I think the "time" characters need to be highlighted and the time picker needs to be closed for the "4 number keys and tab/enter" to be accepted as time entry.  If the time picker is open and the user types 1345 (for example) and then tab or enter it just goes back to 00:00.

Any help / guidance is appreciated.  I had this working with an older version of kendo using the logic below (thanks for your help on that too!) but the new version of ASP.NET Core controls is giving me some trouble achieving it.

Thanks in advance. (i've tried other things than just the below - couldn't get anything to work the way I wanted)

@using Kendo.Mvc.UI

    @(Html.Kendo().DateTimePicker()
            .Name("DateTimeSampled")
            .Format("MM/dd/yyyy HH:mm")
            .ParseFormats(new[] { "MM/dd/yyyy HH mm", "MM/dd/yyyy HH:mm", "MM/dd/yyyy HHmm"})
            .TimeFormat("HH:mm")
            .Events(e =>
            {
                  e.Change("change").Open("open").Close("close");
            })
    )

<script>
    function open(e) {
        console.log("Open :: " + e.view + "-view");
    }

    function close(e) {
        console.log("Close :: " + e.view + "-view");
    }

    function change(e) {
        console.log("Change :: " + kendo.toString(this.value(), 'g'));
        if (e.view == "date") {
           //var picker = e.sender.data("kendoDateTimePicker");
           var picker = $("#DateTimeSampled").data("kendoDateTimePicker");
           console.log(picker);
           //picker.close();
           //e.sender.close();
           var info = kendo.caret(e.sender.element);
           kendo.caret(e.sender.element, info[0] - 5, info[1]); 
        }
    }
</script>

Mihaela
Telerik team
 answered on 03 Jan 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?