Telerik Forums
UI for Blazor Forum
1 answer
25 views

I am getting this error when hosting on our application. It does not appear to happen locally.

 

We are using the new .Net 8 autorender functionality and this seems to happen only in a virtual environment. I can give more context if needed.

image

Nansi
Telerik team
 answered on 21 Mar 2024
0 answers
13 views

I find with the latest Telerik extension enabled, I cannot type anything ( even plain text, with no html tags ) in the non-code section of a razor component ( .razor file ) due to excessive snippet activations ( they don't just list, they insert when spacing to the next word ).  I have played with the VS Options for both csharp and razor editor advanced settings and nothing seems to work.  There are several new settings related to snippets, but the Telerik extension doesn't seem to honor them.  For example, there is one that requires a double tab to select a snippet.  Instead, tab, space, etc select the first one in the list, meaning I am constantly fighting to remove the inserted snippet on literally every other word.  Snippets behave as expected if I disable the Telerik extension and restart VS. And it does it in both the latest Preview and non-Preview versions of Visual Studio ( installed side by side on same machine ).

I feel like this may be more related to recent .net 8 era razor editor changes in VS, some of which is experimental, as well as a "new" razor editor.  ( i have not tested in the legacy razor editor because i don't want to use the legacy razor editor in general ).  I've searched in various ways here and haven't found anyone reporting the same issue, so I'm not sure if it's just me, or if I'm the first to report it.  I don't have any other code helpers or extensions installed.

Thank you for your time and consideration.  I'm happy to jump on a teams call with anyone who might want to see it happening, although it should be easy to replicate on latest VS 2022.

Brian
Top achievements
Rank 1
 updated question on 20 Mar 2024
2 answers
354 views

Is there any plan to add a Org Chart as control ?

The Org Chart should display the reports to / is manager of relation (1:0,m) between employees and/or managers

graphically.

It would be great, if this feature request can be added in the near future...

 

Thanks,

Christian

Chris1108
Top achievements
Rank 1
Iron
 answered on 18 Mar 2024
1 answer
17 views

Hi,

I'm attempting to do something that is probably dumb/unsupported. We have a paginated grid in our UI that we want to include a joined model in.

Example:


public class Item
{
   [Key]
   public Guid ItemId{ get; set; } = Guid.NewGuid();
   public Guid? LatestLogId { get; set; }
}

public class ItemLog
{
   [Key] 
   public Guid ItemLogId{ get; set; }
   
   public Guid ItemId{ get; set; }
   [ForeignKey("ItemId")]
   public Item? Item { get; set; }

   [MaxLength(250)] public string Message { get; set; } = null!;
}


We use 'LatestLogId' in order to know what ItemLog to 'include' in the results in the UI

I'm trying to project it into a Dto that includes both the Item and the LatestLog but running into some trouble calling 'ToDataSourceResultAsync' with that IQueryable<Dto>


 public async Task<DataSourceResult> GetItemReportPage(DataSourceRequest pageRequest, Guid staffId,
        bool includeAll = false)
    {
            var baseQuery = _appContext.Items
                .AsQueryable();
            if (!includeAll)
            {
                baseQuery = baseQuery.Where(x => x.CreatedBy== staffId);
            }
                var query= baseQuery.Select(item => new ItemWithLatestLogDto
                    {
                        LatestLog = _appContext.ItemLogs.FirstOrDefault(x => x.ItemLogId== request.LatestLogId) 
                    })
                    .AsNoTracking();


        var dataSourceResult = await query.ToDataSourceResultAsync(pageRequest);
        return dataSourceResult;
    }


When calling that I get an error that is something like this:


System.InvalidOperationException: The LINQ expression 'DbSet<Item>()
    .Where(n => n.CreatedById== __staffId_0)
    .OrderByDescending(n => new ItemWithLatestLogDto{ LatestLog = DbSet<ItemLog>()
            .Where(r => (Guid?)r.ItemLogId== n.LatestLogId)
            .FirstOrDefault() }
    .CreatedDateTimeUtc)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|15_0(ShapedQueryExpression translated, <>c__DisplayClass15_0&)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
   at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.System.Collections.IEnumerable.GetEnumerator()
   at Telerik.DataSource.Extensions.QueryableExtensions.Execute[TModel,TResult](IQueryable source, Func`2 selector)
   at Telerik.DataSource.Extensions.QueryableExtensions.CreateDataSourceResult[TModel,TResult](IQueryable queryable, DataSourceRequest request, Func`2 selector)
   at Telerik.DataSource.Extensions.QueryableExtensions.ToDataSourceResult(IQueryable queryable, DataSourceRequest request)

The Dto looks like this:

public class ItemWithLatestLogDto: Item
{
    public ItemLog? LatestLog { get; set; } 
 
    public NewFileRequestWithLatestLogDto()
    {
    }
}



Is this a use-case supported by the method or do I need to find a different way of accomplishing this?

Thanks!



Svetoslav Dimitrov
Telerik team
 answered on 11 Mar 2024
1 answer
15 views
My scenario is that I have a grid of User. 
a User has Roles. 

I have a column that I have used the <Template> to display a chip of each Role a User has. 


The FilterTemplate does not have a solution to filter this collection out of the box. 
Have you solved this or similar? Please share any helpful feedback here as I am blocked on this task. 

I would prefer not to filter on a concatenated string of the users roles, as if I click the filter checkbox 'Admin' it would show results for any role that had Admin in it's name. 

If you used the OnRead event, when did you apply your filter and how?  

Thanks so much for your feedback on how you've solved this for your use case. 
 
Nadezhda Tacheva
Telerik team
 answered on 01 Mar 2024
1 answer
22 views

As long as I use an API version > 31, everything works. But older versions won't start. Any ideas?

Once I use <TelerikRootComponent> in the layout, the application stops working.

 

 

Could not find TelerikBlazor.getLocationHost ('TelerikBlazor' was undefined). Error: Could not find 'TelerikBlazor.getLocationHost' ('TelerikBlazor' was undefined). at https://0.0.0.0/_framework/blazor.webview.js:1:540...

Svetoslav Dimitrov
Telerik team
 answered on 27 Feb 2024
0 answers
24 views

I attempted to develop a versatile grid component for Blazor to facilitate reusability.


@typeparam TItem
    <TelerikGrid  Data="Data" SelectionMode="GridSelectionMode.Multiple"
                 Pageable="true" PageSize="3" Page="1"
                 Sortable="true" SortMode="@SortMode.Multiple"
                 FilterMode="GridFilterMode.FilterMenu"
                 EditMode="@GridEditMode.Popup"
                 Resizable="true" Reorderable="true" ConfirmDelete="true">

        <GridSettings>

            <GridValidationSettings Enabled="true"></GridValidationSettings>

            <GridPopupEditSettings MaxWidth="600px"
                                   MaxHeight="300px"
                                   Class="custom-popup"
                                   Title="Update Details">
            </GridPopupEditSettings>
            <GridPopupEditFormSettings Orientation="@FormOrientation.Horizontal"
                                       ButtonsLayout="FormButtonsLayout.Center"
                                       Columns="3">

            </GridPopupEditFormSettings>
        </GridSettings>


        <GridToolBarTemplate>
            <GridCommandButton Command="ExcelExport" Icon="@SvgIcon.FileCsv">Export to Excel</GridCommandButton>
            <GridCommandButton Command="Add" Icon="@SvgIcon.Plus">Add Employee</GridCommandButton>
        </GridToolBarTemplate>

        <GridExport>
            <GridExcelExport FileName="EmployeeDetails Sheet" AllPages="true" />
        </GridExport>

        <GridColumns>
    
            @GridCols
        
            <GridCommandColumn>
                <GridCommandButton Command="Save" Icon="@SvgIcon.Save" ShowInEdit="true">Update</GridCommandButton>
                <GridCommandButton Command="Edit" Icon="@SvgIcon.Pencil">Edit</GridCommandButton>
                <GridCommandButton Command="Delete" Icon="@SvgIcon.Trash">Delete</GridCommandButton>
                <GridCommandButton Command="Cancel" Icon="@SvgIcon.Cancel" ShowInEdit="true">Cancel</GridCommandButton>
            </GridCommandColumn>
        </GridColumns>
    </TelerikGrid>



@code
{
    [Parameter]
     public IEnumerable<TItem>? Data{get; set;}

    [Parameter]
    public RenderFragment<TItem>? GridCols { get; set; }

}
This is the code for the reusable generic grid component.



@page "/emp"
@inject HttpClient Http
@using System.Text.Json;

<h1>Employee Details</h1>

@if (employees == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <GenericGrid TItem="EmpDetails" Data="@employees">
      <GridCols>
            <GridColumn Field="@nameof(EmpDetails.Name)" Title="Employee Name" /> 
            <GridColumn Field="@nameof(EmpDetails.Age)" Title="Age" />
            <GridColumn Field="@nameof(EmpDetails.Place)" Title="Place" />
      </GridCols>
    </GenericGrid>

}

When utilizing the Generic component, the column fields are not being generated as expected. Could someone assist in resolving this issue?
Hyper
Top achievements
Rank 1
 updated question on 25 Feb 2024
0 answers
13 views

Issue Description: I'm encountering challenges with dynamically positioning the command column within the Telerik Blazor DataGrid while using a single grid component for two pages. Each page utilizes the same grid component but may have different sets of columns generated dynamically. Despite this setup, I'm unable to ensure that the command column consistently appears at the last position in the grid on both pages.

Background: In my application, I've implemented Telerik Blazor's DataGrid component to display tabular data across multiple pages. To streamline development and improve code maintainability, I've opted to use a single grid component shared between two pages. Each page may have a different set of columns generated dynamically based on the specific requirements of the page. Additionally, the data source for the grid is an ExpandoObject, and I'm using a loop to dynamically generate columns.

Current Approach: My current approach involves dynamically generating columns using a loop for each page's specific requirements. However, due to the shared nature of the grid component and the dynamic nature of the data source, I'm experiencing difficulties in ensuring that the command column, which contains actions like edit, delete, etc., is consistently positioned at the last column on both pages.

Expected Behavior: I expect to have precise control over the position of the command column within the DataGrid, even when using a single grid component shared between two pages and dynamically generating columns with ExpandoObject as the data source. Regardless of the page being accessed, the command column should always appear at the last position in the grid, providing users with a consistent interface for interacting with the data.

Request for Assistance: I'm seeking assistance from the Telerik community for guidance, insights, or potential workarounds on how to achieve the desired behavior of positioning the command column as the last column in the DataGrid consistently across two pages, even when utilizing a shared grid component and dynamically generating columns with ExpandoObject as the data source.

Any assistance or suggestions would be highly appreciated. Thank you for your support!

0 answers
19 views

Is it possible to change the component's default language without resorting to localization. As of now, I don't really need to customize my app for a specific region and I want to force it to be exclusively in a specific language, in this case Portuguese. By following the tutorial in Blazor Localization - Telerik UI for Blazor I arrive to an annoying problem where dateTime validation triggers format exceptions due to regional formatting of dates.

 

Ricardo
Top achievements
Rank 1
Iron
 asked on 21 Feb 2024
1 answer
77 views

Hi, 

Recently, I just updated my Blazor project to .NET8 and facing the following issue every time rendering Telerik Components. 

This issue doesn't appear when using .NET7 and Telerik Blazor UI 5.0.1. 

Please let me know if you have been facing this issue before.

My current packages:

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Telerik.DataSource" Version="3.0.0" />
<PackageReference Include="Telerik.Documents.Core" Version="2023.3.1106" />
<PackageReference Include="Telerik.Documents.SpreadsheetStreaming" Version="2023.3.1106" />
<PackageReference Include="Telerik.Recurrence" Version="0.2.1" />
<PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2023.2.718" />
<PackageReference Include="Telerik.UI.for.Blazor" Version="5.0.1" />
<PackageReference Include="Telerik.Zip" Version="2023.3.1106" />
</ItemGroup>



 

Dimo
Telerik team
 answered on 02 Feb 2024
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?