Telerik Forums
UI for Blazor Forum
0 answers
8 views

Hi all,

 

I've been observing a strange behavior and cannot seem to find out what causes it. This is primarily to collect some general ideas and learn about principles that I may have missed. I hate to say it but the fact I'm posting it here already suggests that Telerik Blazor UI might be involved, even if it is only by me using it wrong. Before I switched (from Bootstrap UI) to Telerik's Blazor UI, the solution operated more swiftly but was optically inconsistent if not outright ugly. Using Telerik Blazor UI introduced the desired consistency and working with the components is mostly a breeze. I don't regret my choice at all, and will do whatever is needed to keep it part of the solution.

For more context: this is about a multi-layered Blazor app (ASP.NET Core 8) using Telerik's Blazor UI to give users CRUD operations on medical case data. It is supposed to show data from an Oracle relational database with Entity Framework (EF Core 8). It's a data-first approach so I have built entity classes representing each table (about 30 tables in total now) and configured their relations mostly manually. But that's not actually the point. It's just to describe why I can't just paste a small code snippet here. It's a medical application so I'm legally unable to paste code 1:1 from my solution, and it's tons of code by now. Hope the description I'm giving below is enough to put you in the frame.

There are multiple Razor pages and components, some with more and some with less complexity:

  • entry pages where users select a quarter and doctor's office
  • next page reveals the cases that need work
  • selecting a case will go to the editor Blazor page which:
    • shows case basic data such as patient, insurance, summary
    • shows relational positional data in up to four separate grids (Telerik Data Grid) which are encapsulated in Razor components again to keep the main page as slim as possible
    • allows CUD operations and validations on relatonal data
    • uses models to do real-time calculations when users are modifying data
    • uses a persistence layer to collect changes and update storage

The editor page (the heaviest piece of the solution) features:

  • a Telerik menu bar
  • a Telerik breadcrumb bar
  • a Telerik dock manager
  • up to 8 dock panes, half containing Razor components rendering HTML tables, the other half being Telerik data grids
  • some interaction between DockManager and menu bar for menu items to control the visibility and arrangement of panes
  • lots of Telerik(MultiColumn)ComboBox, TelerikTextBox, TelerikDatePicker, TelerikNumericTextBox, TelerikMaskedTextBox etc. inside the panes for data representation and editing

All pages use InteractiveServer render mode as that is what I found works best for me. Until now, the software is only running on my dev machine in Visual Studio 2022, and most of the time in debug mode.

IMPORTANT: Let me emphasize that what I am describing here appears exclusively in debug mode as long as VS2022 is attached, and not when the solution is run by dotnet run. It's a p.i.t.a. though to debug with the handbrake engaged, and I'm not sure if the process does not hide a problem even when it runs without a debugger attached. It's just much faster then but that's not proof that whatever issue it is only affects the debug scenario.

The problems begin when I start navigating between the pages. Sometimes it's really fast, sometimes the same thing takes a lot of time. In my perception it might be related to how quickly I navigate but the actual trigger for the behavior is mostly unclear at this time. Heavier pages cause longer delays (and more exceptions along the way), while being loaded as well as while navigating away from them. But it's not consistent enough to point to an overall page or DOM size-related issue.

What struck me is that the debug console gets flooded with errors like these as delays are happening:

Exception thrown: 'Microsoft.JSInterop.JSDisconnectedException' in Microsoft.JSInterop.dll
Exception thrown: 'Microsoft.JSInterop.JSDisconnectedException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.JSInterop.JSDisconnectedException' in System.Private.CoreLib.dll
Exception thrown: 'Microsoft.JSInterop.JSDisconnectedException' in Microsoft.AspNetCore.Components.Server.dll

The one from System.Private.CoreLib.dll appears twice most of the time, sometimes only once. A block like this is shown repeatedly up to 90 times in quick succession, in worse cases, sometimes only ten of these blocks appear in the console. But it's always this combination of the same three DLLs being addressed. When this happens, no other exceptions mix in, it's a constant stream of these three / four exceptions. The application is massively slowed down as this happens. Not as much as showing me a waiting indicator and reconnecting in the page though.

What's also interesting is that the user-end of the solution, besides being very slow at times, behaves fully normally. There are no errors or exceptions apparent to the user. To me this looks like the exceptions are silently consumed somewhere without giving further detail. Each occurrence takes some processing time. I can't say where the exceptions are thrown - probably somewhere deep inside the JS layers - but it's really unsettling and I have some doubts about moving this to production unless this is clarified a bit better.

The Edge browser's developer tools show nothing unusual. The JavaScript console there stays error-free, and running a network recording during a page refresh does show that loading takes very long (about 5 out of 10 seconds are spent with no traffic at all), but all HTTP operations have status 101 (switching protocols) or 200 (success). No error indication at all there.

I beg your pardon for being too unspecific where it may count but this is honestly my first Blazor application at all, and it's a monster of a project right away. I'm overwhelmed by the time pressure already and there's no team mates to help out. Random delays are the last thing I need.

So to wrap this up, what I'm looking for is basically guidance like:

  • is ServerInteractive (and no prerendering) a preferable mode to use globally?
  • do I have to clean up anything? I was hoping the Telerik components would take care of their memory allocations and connections on their own. If that's wrong or not enough, is IDisposable the way to go? What would have to be forcefully disposed?
  • are there any typical no-nos about Blazor apps that I might have missed, such as exceeding a hidden limit regarding the amount of HTML elements in the DOM, or having to keep the number of data grids to a minimum? Could two-way bindings be a root cause? (I'm using them a lot)
  • I'm using async wherever it makes sense, assuming that's the way to go nowadays. Anthing special about Blazor regarding async?
  • sometimes, I need to call StateHasChanged() to ensure the UI is up-to-date. This may indicate I'm missing a cleaner way to achieve the same, however, I couldn't find anything about this yet

Thank you all for reading, and in advance for any clues.

Cheers, have a nice day!

Joe

1 answer
13 views

Is it possible to change the headings in the column chooser menu?

This is supported in other Telerik products by using the Messages property which is absent in Blazor

Dimo
Telerik team
 answered on 23 Oct 2025
2 answers
17 views

Hi,

I've created a Telerik Blazor grid like the one in the Repl: https://blazorrepl.telerik.com/mpONGnvz356DEAKK31

There I use dynamic columns combined with a nullable dictionary. Everything works fine.

But when I group by the bool column the Count in the group header gets mixed up.

Does anybody have an idea how to fix that?

 

Best regards,

Rayko

Rayko
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 26 Sep 2025
1 answer
12 views

How can i add a data-testid to a GridCommandColumn?

I am trying to add a static id to a GridCommandColumn, but am not having any luck.  For GridColumns I am able to add a HeaderTemplate and add a data-testid that way

<GridColumn HeaderClass="left-wrap" Field="UId" Visible="false" ShowFilterCellButtons="false" Title="TestColumn">

<HeaderTemplate>
<div id="col-testcolumnid-home" data-testid="col-testcolumnid-home" class="k-cell-inner">
<span class="k-link">TestColumn</span>
</div>
</HeaderTemplate>
</GridColumn>

Is there a way to add a data-testid to a GridCommandColumn component?

Dimo
Telerik team
 answered on 26 Sep 2025
1 answer
31 views
How do I hide a field in the standard popup window when Add button is clicked?
Ivan Danchev
Telerik team
 updated answer on 16 Sep 2025
1 answer
20 views

Hi guys,

I have a grid with inline editing and I want to add some custom validation, as you can check below.

<TelerikGrid Data="@Model.Equipments"
             EditMode="GridEditMode.Inline"
             OnUpdate="@OnUpdate"
             OnCreate="@OnCreate"
             OnDelete="@OnDelete">
    <GridToolBarTemplate>
        <GridCommandButton Command="Add">Add new equipment</GridCommandButton>
    </GridToolBarTemplate>
    <GridColumns>
<GridColumn Field="@nameof(Equipment.Code)"
                    Title="Code">
            <EditorTemplate>
                @{
                    Equipment item = (Equipment)context;
                }
                <div class="k-form-field-wrap">
                    <TelerikTextBox @bind-Value="item.Code" />
                    <TelerikValidationMessage For="@(() => item.Code)" />
                </div>
            </EditorTemplate>
        </GridColumn>
        <GridColumn Field="@nameof(Equipment.Name)"
                    Title="Name">
            <EditorTemplate>
                @{
                    Equipment item = (Equipment)context;
                }
                <div class="k-form-field-wrap">
                    <TelerikTextBox @bind-Value="item.Name" />
                    <TelerikValidationMessage For="@(() => item.Name)" />
                </div>
            </EditorTemplate>
        </GridColumn>       
        <GridCommandColumn Width="185px">
            <GridCommandButton Command="Edit">Edit</GridCommandButton>
            <GridCommandButton Command="Delete">Delete</GridCommandButton>
            <GridCommandButton Command="Save" ShowInEdit="true">Save</GridCommandButton>
            <GridCommandButton Command="Cancel" ShowInEdit="true">Cancel</GridCommandButton>
        </GridCommandColumn>
    </GridColumns>
</TelerikGrid>

private void OnCreate(GridCommandEventArgs args)
{
    Equipment item = (Equipment)args.Item!;

    item.Id = Guid.CreateVersion7();

    Model.Equipments.Add(item);
}

private void OnUpdate(GridCommandEventArgs args)
{
    Equipment item = (Equipment)args.Item!;

    int indexToUpdate = Model.Equipments.FindIndex(e => e.Id == item.Id);

    if (indexToUpdate != -1)
    {
        Model.Equipments[indexToUpdate] = item;
    }
}

private void OnDelete(GridCommandEventArgs args)
{
    Equipment item = (Equipment)args.Item!;

    int indexToRemove = Model.Equipments.FindIndex(e => e.Id == item.Id);

    if (indexToRemove != -1)
    {
        Model.Equipments.RemoveAt(indexToRemove);
    }
}



public sealed class Equipment
{
    public Guid Id { get; set; }

    [Required]
    public string? Name { get; set; }

    [Required]
    public string? Code { get; set; }
}

If I don't fill in the Name or Code, I and I hit Save, I can see the validation message under the corresponding column in the row that is in edit mode. So far so good.

However, say that I want the code to be unique. How to I tackle this one? I would like to see a validation message under the Code textbox "That code already exists", or whatever the message might be.

Any guidance on the recommended approach here would be great—thanks!

Regards,

Bogdan

Dimo
Telerik team
 answered on 03 Sep 2025
1 answer
52 views
I have a Grid with dynamic number of column (using ExpandoObject) and I want to create a custom row filter with a single text input field that uses a kind of simple wildcard logic I've already written, like "joh*" and so on. My question is how I call my wildcard method. I've started out with a FilterCellTemplate and TelerikTextBox where I can capture ValueChanged and I have access to the new value and the FilterCellTemplateContext. But how to continue? I've search the website without much success. Is it possible to call my wildcard logic from a custom FilterDescriptor?
Dimo
Telerik team
 answered on 26 Aug 2025
1 answer
24 views

When I call "Dialogs.AlertAsync", I get null reference error. Any reason why?  The whole page is under TelerikRootComponent.


<TelerikGrid Data="@availableSchedules" class="myTelerik-grid" SelectionMode="GridSelectionMode.Multiple"
             SelectedItems="@selectedSchedules"
             SelectedItemsChanged="@((IEnumerable<BTWInstructorAvailability> newSelected) => OnRowSelect(newSelected))"
             ScrollMode="GridScrollMode.Scrollable" Height="300px">
    <GridColumns>
        <GridCheckboxColumn CheckBoxOnlySelection="true" SelectAll="false" />
        <GridColumn Field="InstructorName" Title="Instructor Name" />
        <GridColumn Field="StartDate" DisplayFormat="{0:MM/dd/yyyy}" Title="Start Date" />
        <GridColumn Field="EndDate" DisplayFormat="{0:MM/dd/yyyy}" Title="End Date" />
        <GridColumn Field="Languages" Title="Languages" />
    </GridColumns>
</TelerikGrid>


protected async Task OnRowSelect(IEnumerable<BTWInstructorAvailability> newSelected)
{
    // Enforce max selection of 3
    if (newSelected.Count() > 3)
    {
        await Dialogs.AlertAsync("Maximum of 3 lessons can be selected.");
        return; 
    }

    selectedSchedules = newSelected;
}

Dimo
Telerik team
 answered on 21 Aug 2025
1 answer
32 views

I have a grid that is needs to use EditMode=GridEditMode.Incell.  I have a Telerik CheckBox defined under Template for  a GridColumn.  In order to prevent the need to click twice on the checkbox in the grid (click once to enter edit and click again to actually change the state of the checkbox to checked/unchecked), I have to set the GridColumn to Editable=false and then use OnChange to set the model value:

 <TelerikGrid @ref="@BookingEquipmentGridRef"
              Data="@BookingEquipmentList"
              EditMode="@GridEditMode.Incell"
              OnEdit="@OnEquipmentEdit"
              OnRowClick="@OnEquipmentRowClick"
              OnRowRender="@OnRowRenderHandler"
              OnUpdate="@OnEquipmentUpdate"
              OnStateInit="@((GridStateEventArgs<BookingEquipmentModel> args) => OnEquipmentGridStateInit(args))"
              Height="226px"
              Size="@ThemeConstants.Grid.Size.Small"
              SelectionMode="GridSelectionMode.Single"
              SelectedItems="@SelectedEquipmentList"
              FilterMode="GridFilterMode.FilterMenu"
              Resizable="true"
              Sortable="true"
              Reorderable="true"
              Pageable="true"
              EnableLoaderContainer="false"
              PageSize="25">
   <GridColumns>
                <GridColumn Field=@nameof(BookingEquipmentModel.IsChassis) Title="Chassis" Editable="false" Filterable="false" Width="5rem">
                    <Template>
                        @{
                            var bem = (BookingEquipmentModel)context;
                        }
                        <TelerikCheckBox Value="@bem.IsChassis" ValueExpression="@(() => bem.IsChassis)" ValueChanged="@((bool newValue) => OnChassisChanged(newValue, bem))" />
                    </Template>
                </GridColumn>

   </GridColumns>
</TelerikGrid>

Because I have to set Editable=false the OnEdit event is not fired so I no longer can use args.IsCancelled = true to prevent cell update. In my OnChassisChanged I can not assigned the value to the model but the visual state will no longer match.


    private Task OnChassisChanged(bool newValue, object item)
    {
        if (item == null) return Task.CompletedTask;

        BookingEquipmentModel selectedEquipmentModel = (BookingEquipmentModel)item;

        if (EditableState(SelectedBooking, selectedEquipmentModel) == BookingEquipmentState.EditableStatus.No) return Task.CompletedTask;

        selectedEquipmentModel.IsChassis = newValue;
        selectedEquipmentModel.IsEdit = true;
        DataState.State = DataState.States.UnSaved;

        return Task.CompletedTask;
    }

My users were complaining about having to click twice on a checkbox to set it's new state (checked or unchecked) ... and I agree with their issue, but I can't seem to find a solution (and keep using the TelerikCheckBox) ... any suggestions?

I seem to recall reading  another thread from some other user having similar problem, but seem unable to locate it again.

 

 

Dimo
Telerik team
 answered on 21 Aug 2025
1 answer
18 views
How can I change the text for the save command for a row to say add when it's adding a new item and Update when it's updating a new item? Is there no official way and I have to manually do that? Thanks!
Dimo
Telerik team
 answered on 20 Aug 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
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
Iron
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?