Telerik Forums
UI for ASP.NET Core Forum
0 answers
60 views

Hi,
I am trying to implement telerik components in my Sitefinity site, the components seems to work fine, but when i add the 3er part of the documentation, gives me an error call "Invalid template", any ideas what could be the problem? https://docs.telerik.com/aspnet-core/html-helpers/layout/tilelayout/getting-started.

PS: For more context, i made the component as a widget in Sitefinity, also the 2nd step of the documentation works fine, all the CSP security allows scripts like in the example(i made a component that use scripts and works fine).

This code works,

    @addTagHelper *, Kendo.Mvc

<kendo-tilelayout name="tilelayout" columns="2">
    <containers>
        <container>
            <container-body-template>Container 1</container-body-template>
            <container-header text="Title 1" />

        </container>
        <container>
            <container-body-template>Container 2</container-body-template>
            <container-header text="Title 2" />
        </container>
        <container>
            <container-body-template>Container 3</container-body-template>
            <container-header text="Title 3" />
        </container>
    </containers>
</kendo-tilelayout>

This code doesn't work,

@addTagHelper *, Kendo.Mvc



<script id="tabStripContainer" type="text/html">
    <kendo-tabstrip name="tabstrip" is-in-client-template="true">
        <items>
            <tabstrip-item text="Dashboard Information" selected="true">
                <content>
                    <div class="status-cards">
                        <div class="k-card">
                            <div class="k-card-body">
                                <div class="k-card-result on-track-tasks">22</div>
                                <div class="k-card-title">Items in Backlog: 43</div>
                            </div>
                        </div>
                        <div class="k-card">
                            <div class="k-card-body">
                                <div class="k-card-result overdue-tasks">7</div>
                                <div class="k-card-title">From Yesterday: 16</div>
                            </div>
                        </div>
                        <div class="k-card">
                            <div class="k-card-body">
                                <div class="k-card-result issues">47</div>
                                <div class="k-card-title">Closed By Team: 15</div>
                            </div>
                        </div>
                    </div>
                </content>
            </tabstrip-item>
            <tabstrip-item text="Calendar">
                <content>
                    <div class="calendar-widget">
                        <kendo-calendar name="calendar" component-type="modern" is-in-client-template="true"></kendo-calendar>
                    </div>
                </content>
            </tabstrip-item>
        </items>
    </kendo-tabstrip>
</script>
<kendo-tilelayout name="tilelayout" columns="1">
    <containers>
        <container body-template-id="tabStripContainer"></container>
    </containers>
</kendo-tilelayout>



Mateo
Top achievements
Rank 1
 asked on 05 Feb 2025
2 answers
116 views
Im having difficulty making customizations to my grid. Ive left my commented out code in there for some items I have tried and didnt work. Ive listed out below what I am trying to do. Any help would be greatly appreciated
  1. Trying to give PartyRoleOverride a drop down list on edit
  2. Trying to make fields not editable. Code is currently in there below and just does nothing
  3. Make fields not required. All fields are currently required and did not specify required anywhere but only see how to make things required?
  4. Making isProSe field show as a yes/no rather than true false
    @page
    @addTagHelper *, Kendo.Mvc
@using Kendo.Mvc.UI
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
@Html.AntiForgeryToken()

<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://unpkg.com/jszip/dist/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2024.4.1112/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2024.4.1112/js/kendo.aspnetmvc.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/themes/10.0.1/default/default-ocean-blue.css">

                   <div id="parties-scheduling" style="margin-right:8px;border:none;padding:0;color:black;">
                        <div id="PartiesTopRowInfo">
                            @Html.Kendo().Grid(Model.MiscellaneousInfo.PartyInfoList).Name("PartyGrid").ToolBar(x => 
                              x.Create()).Size(ComponentSize.Small).Editable(GridEditMode.PopUp).Resizable(r => r.Columns(true)).Columns(col =>
                             {                                
                                 col.Bound(c => c.Name.BuiltName).Title("Name").Width(175);
                                 col.Bound(c => c.PartyRole).Title("Role").Width(150);
                                 //col.Bound(c => c.PartyRoleOverride).Title("Role Override").Width(150).EditorTemplateName("rolesEditor");
                                 // col.Bound(c => c.PartyRoleOverride).Title("Role Override").Width(150).ClientTemplate("#=rolesEditor#");
                                     // col.Bound(c => c.PartyRoleOverride).Title("Role Override").Width(150).EditorTemplateComponentName("rolesEditor"); 
                                 col.Bound(c => c.PartyRoleOverride).Title("Role Override").Width(150);
                                 col.Bound(c => c.AppearanceType).Title("Appear Type").Width(100);
                                 col.Bound(c => c.Timely).Width(60);
                                 col.Bound(c => c.ServiceType).Width(150);
                                 col.Bound(c => c.DateServed).Width(100);
                                     col.Bound(c => c.isProse).Title("ProSe").Width(55);/* .ClientTemplate("#= MyBool ? 'Yes' : 'No' #"); */
                                 col.Command(c => 
                                 {
                                     c.Edit();
                                     c.Destroy();
                                 }).Width(170);
                             }).Sortable().DataSource(dataSource =>dataSource
                             .Ajax()
                             .Read(r => r.Url("/Appearances/MiscellaneousInformation?handler=Read").Data("forgeryToken"))
                             .Update(r => r.Url("/Appearances/MiscellaneousInformation?handler=Update").Data("forgeryToken"))
                             .Create(r => r.Url("/Appearances/MiscellaneousInformation?handler=Create").Data("forgeryToken"))
                             .Destroy(r => r.Url("/Appearances/MiscellaneousInformation?handler=Destroy").Data("forgeryToken"))
                              .Model(m => m.Id(id => id.PartyAppearanceID))
                              .Model(m => m.Field(party => party.PartyRole).Editable(false))
                              .Model(m => m.Field(party => party.PartyRoleOverride).Editable(false))
                              .Model(m => m.Field(party => party.Name.BuiltName).Editable(true))
                              .Model(m => m.Field(party => party.isProse).Editable(false))
                              // .Model(m=> m.Field(party => party.PartyRoleOverride).DefaultValue(new List<String>{
                              //     "Role1","Role2","Role3"
                              // }))
                              )
                              
                         </div>
                    </div>

 function rolesEditor(container, options) {
     $('<input name="PartyRoleOverride" style="width:300px;">')
         .appendTo(container)
         .kendoDropDownList({
             autoBind: false,
             dataTextField: "RoleDesc",
             dataValueField: "RoleID",
             dataSource: {
                 data: roles
             }
         });
 }

var roles = [{
     "RoleID": 1,
     "RoleDesc": "Administrator"
 }, {
     "RoleID": 2,
     "RoleDesc": "Bank"
 }, {
     "RoleID": 3,
     "RoleDesc": "Guardian"
 }];


public class MiscellaneousInformationModel : PageModel
    {
        public CoreFileInfoObj CoreFileInfoObj { get; set; } = new CoreFileInfoObj();
        public SharedFunctions sharedFunctions { get; set; }

        [BindProperty]
        public MiscellaneousInfoDTO MiscellaneousInfo { get; set; } = new MiscellaneousInfoDTO();
}




    public class MiscellaneousInfoDTO
    {
        public List<PartyInfoDTO> PartyInfoList { get; set; }

    }


public class PartyInfoDTO
{
    public int PartyAppearanceID { get; set; }

    public NameDTO Name { get; set; }

    public string PartyRole { get; set; }

    public string PartyRoleOverride { get; set; }

    public string AppearanceType { get; set; }

    public Boolean Timely { get; set; }

    public string ServiceType { get; set; }

    public DateTime? DateServed { get; set; }

    public Boolean isProse { get; set; }
}


    public class NameDTO
    {
        public NameDTO()
        {

        }

        public string FirstName { get; set; }

        public string MiddleName { get; set; }
        public string LastName { get; set; }

        public string Organization { get; set; }

        public string Suffix { get; set; }

        public string BuiltName { get; set; }

    }

 

Alexander
Telerik team
 answered on 04 Feb 2025
1 answer
80 views

Hello

I am struggling to find any documentation/examples of Razor grid syntax beyond just a basic way to get the page working. For example I have code that makes the basic grid, and it seems like there are a lot of features but I dont know how to use them. My specific questions are:

1. How do I control which fields show as editable when I click to edit? Currently they just all show and that is not what I want. I see I can add .Editable() to the columns but I dont see any documentation as to what value Im supposed to pass into there (besides the method signature) because it doesnt accept true/false?

2. In the fields that show, how do I control which fields are required? They are currently all by default required and that is not what I want.

3. I am looking to make the Boolean values show as Yes/No rather than true false. I see possibly this as a solution but it just tells me #MyBool is not defined.: 

     col.Bound(c => c.isProse).Title("ProSe").Width(55).ClientTemplate("#= MyBool ? 'Yes' : 'No' #"); 

 

Grid Code:

                    <div id="parties-scheduling" style="margin-right:8px;border:none;padding:0;color:black;">
                        <div id="PartiesTopRowInfo">
                            @Html.Kendo().Grid(Model.MiscellaneousInfo.PartyInfoList).Name("PartyGrid").ToolBar(x => 
                              x.Create()).Size(ComponentSize.Small).Editable(GridEditMode.PopUp).Resizable(r => r.Columns(true)).Columns(col =>
                             {
                                 // col.Select().Width(50).HtmlAttributes(new { @class = "checkbox-align" }).HeaderHtmlAttributes(new { @class = "checkbox-align" });
                                 col.Bound(c => c.Name.BuiltName).Title("Name").Width(175);
                                 col.Bound(c => c.PartyRole).Title("Role").Width(150);
                                 col.Bound(c => c.PartyRoleOverride).Title("Role Override").Width(150);
                                 col.Bound(c => c.AppearanceType).Title("Appear Type").Width(100);
                                 col.Bound(c => c.Timely).Width(60);
                                 col.Bound(c => c.ServiceType).Width(150);
                                 col.Bound(c => c.DateServed).Width(100);
                                 col.Bound(c => c.isProse).Title("ProSe").Width(55);
                                 col.Command(c => 
                                 {
                                     c.Edit();
                                     c.Destroy();
                                 }).Width(170);
                             }).Sortable().DataSource(dataSource =>dataSource
                             .Ajax()
                             .Read(r => r.Url("/Appearances/MiscellaneousInformation?handler=Read").Data("forgeryToken"))
                             .Update(r => r.Url("/Appearances/MiscellaneousInformation?handler=Update").Data("forgeryToken"))
                             .Create(r => r.Url("/Appearances/MiscellaneousInformation?handler=Create").Data("forgeryToken"))
                             .Destroy(r => r.Url("/Appearances/MiscellaneousInformation?handler=Destroy").Data("forgeryToken"))
                              .Model(m => m.Id(id => id.PartyAppearanceID)))
                              
                         </div>
                    </div>

 

 

Alexander
Telerik team
 answered on 31 Jan 2025
1 answer
208 views

Hi, I have a working, simple, ASP.NET core program (using .NET 9) and adding Telerik ASP.NET Core breaks the project (~sigh~). The project issues warnings regarding CodeAnalysis resolution. I tried adding the package (as per the .NET 8 fix (Upgrading to .NET 8)) - that made things worse.

 

I've tried using the Telerik wizard in VS2022 or manually (which historically has not been an issue.

Follow-up note: Issue is related to EntityFrameworkCore, which has a dependency on Microsoft.CodeAnalysis 4.8.

- adding Telerik,UI.for.ASPNet.Core to this configuration creates version issues for EF packages and Telerik. The project configuration before adding Telerik is the ASP.NET Core project template for Razor Page based project (Visual Studio 2022 with up-to-date patching.)

Any suggestions (please).

 

Thank you.

Anton Mironov
Telerik team
 answered on 31 Jan 2025
1 answer
86 views
Is it possible to make the editor component read only?
Eyup
Telerik team
 answered on 27 Jan 2025
1 answer
79 views

For Telerik ASP.Net Core Q4 2024 release,

The following declaration, the value is not show on the component

@Html.Kendo().DatePickerFor(m => m.ContractStartDate)

However, TagHelper is working

<kendo-datepicker for="ContractStartDate">
</kendo-datepicker>

No issue in 2024 Q3 version. Kindly assist.

Thanks.

 

Eyup
Telerik team
 answered on 21 Jan 2025
1 answer
117 views

Hi there,

 

In order to create a chat screen I need to adjust kendo chat to be full screen, how can I do that?

https://docs.telerik.com/aspnet-mvc/html-helpers/conversational-ui/chat/getting-started

 

Thanks

Eyup
Telerik team
 answered on 20 Jan 2025
1 answer
220 views

Im getting this error whenever I try to add the Kendo grid into my project. I am using asp .netcore8 razor pages. I have followed the tutorials on how to install Telerik and thought I did so correctly. The working example directly from a Telerik tutorial project doesnt work in mine and produces this error, and I have all of the same Nuget packages, etc. The only difference is I have my setup in the Startup.cs file rather than Program.cs?

 

Ive attached my files.

 

Thanks!

Ivaylo
Telerik team
 answered on 20 Jan 2025
1 answer
76 views

Hello,

I need to display multiple ExpansionPanels with nested TreeViews, however I don't find examples of this, and this code is failing with exception:


@(Html.Kendo().ExpansionPanel()
				.Title(group.Text)
				.Content(@<text>
					@(Html.Kendo().TreeView()
					.Name("tree" + group.Id)
					.CheckboxTemplateId("checkbox-template")
					.Checkboxes(true)
					.BindTo(group.Items))
				</text>)
)

Fails with: 


fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HN9NPOSEKJS4", Request id "0HN9NPOSEKJS4:00000002": An unhandled exception was thrown by the application.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at Kendo.Mvc.UI.WidgetBase.VerifySettings()
         at Kendo.Mvc.UI.WidgetBase.WriteHtml(TextWriter writer)
         at Kendo.Mvc.UI.ExpansionPanel.WriteHtml(TextWriter writer)
         at Kendo.Mvc.UI.WidgetBase.RenderHtml(TextWriter writer)
         at Kendo.Mvc.UI.WidgetBase.ToHtmlString()
         at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString()
         at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.WriteTo(TextWriter writer, HtmlEncoder encoder)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.Buffers.ViewBuffer.WriteToAsync(TextWriter writer, HtmlEncoder encoder)
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
         at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
         at Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware.InvokeAsync(HttpContext context)
         at Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware.InvokeAsync(HttpContext context)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Treeview works in itself and if I wrap it in ExpansionPanel raw HTML. 

Is there anyway around it?

Thank you.

Justinas
Top achievements
Rank 1
Iron
 answered on 18 Jan 2025
3 answers
798 views
Hey, 

All our pipelines have broken due to the sunsetting of the V2 endpoint, my attempt at fixing these have stopped with this error

##[error]The nuget command failed with exit code(1) and error(NU1301: Failed to retrieve information about 'Telerik.UI.for.AspNet.Core' from remote source 'https://nuget.telerik.com/v3/nuget/FindPackagesById()?id='Telerik.UI.for.AspNet.Core'&semVerLevel=2.0.0'.

this is happening in an azure devops pipeline using the latest nuget version 

we are using a nuget.config file in the same folder as our .sln

and this is what the file looks like (minus the real credentials)


<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.telerik.com" value="https://nuget.telerik.com/v3/nuget" />
</packageSources>

<packageSourceMapping>
<packageSource key="nuget.telerik.com">
<package pattern="Telerik.UI.for.AspNet.Core" />
</packageSource>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>

<packageSourceCredentials>
<telerik>
<add key="Username" value="user" />
<add key="ClearTextPassword" value="pass" />
</telerik>
</packageSourceCredentials>

<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
</configuration>


any ideas? we would really like to deploy again...

Also, this works perfectly fine on our local machines.
Misho
Telerik team
 answered on 16 Jan 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?