Telerik Forums
UI for ASP.NET Core Forum
1 answer
34 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
77 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
37 views
Is it possible to make the editor component read only?
Eyup
Telerik team
 answered on 27 Jan 2025
1 answer
32 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
35 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
64 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
50 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
433 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
1 answer
22 views

Hi,

the following template is partially working when used in a grid-row-template. 


                <grid-row-template>
                    <div>${data.Name}</div>
                    #if(data.HasLastName){#
                          <div>${data.LastName}</div>
                    #} else {#
                          <div>some other stuff</div>
                    #}#
                </grid-row-template>

values inside ${ } are properly replaced, however the code inside # # is not executed, it is rendered as text. 

What is the proper way to include conditionals in this case?

 

regards

Eyup
Telerik team
 answered on 15 Jan 2025
1 answer
26 views
Hi Team,

I am facing an issue where formulas in the spreadsheet are not properly reflecting when importing or downloading sheets in my application. Specifically, the formulas are not retained during the upload process or included correctly during the export/download operation.

Below are the reference codes for upload and download functionality:

Upload Code:
using (var package = new ExcelPackage(stream))
{
    var workbook = package.Workbook;
    var worksheet = workbook.Worksheets[0];

    var rows = new List<dynamic>();
    for (int row = 1; row <= worksheet.Dimension.End.Row; row++)
    {
        var rowData = new List<string>();
        for (int col = 1; col <= worksheet.Dimension.End.Column; col++)
        {
            rowData.Add(worksheet.Cells[row, col].Text);
        }
        rows.Add(new { cells = rowData.Select(val => new { value = val }).ToArray() });
    }

    var sheetData = new
    {
        name = worksheet.Name,
        rows = rows.ToArray()
    };

    return Json(new { success = true, data = sheetData });
}



Download Code:
using (var package = new ExcelPackage())
{
    var sheet = spreadsheetData.sheets.FirstOrDefault();
    if (sheet != null)
    {
        var worksheet = package.Workbook.Worksheets.Add(sheet.name);

        foreach (var row in sheet.rows)
        {
            foreach (var cell in row.cells)
            {
                var excelCell = worksheet.Cells[row.index + 1, cell.index + 1];

                // Set font properties
                excelCell.Style.Font.Size = cell.fontSize > 0 ? cell.fontSize : sheet.defaultCellStyle.fontSize;
                excelCell.Style.Font.Bold = cell.bold;

                // Set background color
                if (!string.IsNullOrEmpty(cell.background))
                {
                    excelCell.Style.Fill.PatternType = ExcelFillStyle.Solid;
                    excelCell.Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml(cell.background));
                }

                // Set font color
                if (!string.IsNullOrEmpty(cell.color))
                {
                    excelCell.Style.Font.Color.SetColor(ColorTranslator.FromHtml(cell.color));
                }

                // Set text alignment
                excelCell.Style.HorizontalAlignment = cell.textAlign switch
                {
                    "center" => ExcelHorizontalAlignment.Center,
                    "right" => ExcelHorizontalAlignment.Right,
                    _ => ExcelHorizontalAlignment.Left,
                };

                // Set number format
                if (!string.IsNullOrEmpty(cell.format))
                {
                    excelCell.Style.Numberformat.Format = cell.format;
                }

                // Set formula if available
                excelCell.Formula = cell.formula;
                
                // Set cell value
                excelCell.Value = cell.value;
            }
        }
    }

    fileStream = new MemoryStream(package.GetAsByteArray());
}


Could you please guide me on resolving this issue to ensure formulas are preserved and processed accurately?

Thank you for your assistance!
Anton Mironov
Telerik team
 answered on 14 Jan 2025
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?