Telerik Forums
UI for Blazor Forum
1 answer
98 views

Hi there.
I have a list of a class which contains 2 string properties, "MyValueField" and "MyTextField".
If one of the items in the list has the MyValueField property set to an empty string (in the example below it's the first item), selecting that item in the TelerikDropDownList will assign null to the binded value. Instead, an empty string should be assigned to the binded value variable.
It is worth noting that "externally" assigning the binded value variable to an empty string (either on initialization or through a button) will successfully work and the TelerikDropDownList component will display the selected item.

The following gif showcases the binded value variable becoming null when the item with MyValueField set to an empty string is selected through the TelerikDropDownList: https://i.gyazo.com/3d75359334d900a74334ae6de2493576.mp4
The following gif showcases the binded value variable becoming an empty string when pressing a button that sets it to one, and gets set to null when the first item in the TelerikDropDownList is selected: https://i.gyazo.com/12ee88a8e161f8c3b5a023d8fbc44a28.mp4

Here is the REPL link: https://blazorrepl.telerik.com/GfYbuCFt318IzZzv41
This also affects the ComboBox component: https://blazorrepl.telerik.com/czOPYjFf04sX7cIW36

Dimo
Telerik team
 answered on 14 Jan 2025
1 answer
41 views

Blazor, .net 6.0, Telerik.UI.for.Blazor 5.1.1

I have a Blazor app with a page that contains a TelerikGrid (using inline edit) with 2 columns that use TelerikDropDownList that cascade.  When no option is selected in the parent ddl, then the child ddl has no items and is disabled (enabled = false).  When an item is chosen in the parent ddl, then the child ddl has its list of options updated.  However, the child ddl is not refreshing until the user clicks somewhere in the row being edited.  Once clicking anywhere in the row, then the child ddl displays properly:  1) becomes enabled, 2) contains the new list, 3) wipes out any previously selected value.

Other than that initial refresh, the code works.  It saves, it updates the child options, etc.

No matter what I do, I cannot seem to get it refresh the child ddl without first clicking on the row.  I have all different combinations of HasStateChanged(), ddl.Rebind(), ddl.Refresh(), ddl.DropDownList_Focus().  None of these seem to have made a difference.

Below is the relevant code portions.

<GridColumn Title="Module" Field="ModuleId" Visible="isFileLocationRequired">
    <EditorTemplate>
        @{
            var editingFileType = context as FileType;
            <TelerikDropDownList Data="@SelectableModules"
                                 TextField="TextValue"
                                 ValueField="FieldId"
                                 @bind-Value="editingFileType.ModuleId"
                                 OnChange="UpdateSelectableFileLocations">
            </TelerikDropDownList>
        }
    </EditorTemplate>
</GridColumn>
<GridColumn Title="File location name" Field="FileLocationId" Visible="isFileLocationRequired">
    <EditorTemplate>
        @{
            var editingFileType = context as FileType;
            <TelerikDropDownList Data="@SelectableFileLocations"
                                 TextField="FileLocationName"
                                 ValueField="FileLocationId"
                                 @bind-Value="editingFileType.FileLocationId"
                                 Enabled="@editingFileType.ModuleId.HasValue">
            </TelerikDropDownList>
        }
    </EditorTemplate>
</GridColumn>

 

    private List<FileLocations> SelectableFileLocations = new();
    private List<FieldOptions> SelectableModules = new();
    private void UpdateSelectableFileLocations(object input)
    {
        int? moduleId = input as int?;
        SelectableFileLocations = FileLocations
            .Where(fileLocation => fileLocation.CategoryId == moduleId)
            .ToList();
    }
Dimo
Telerik team
 answered on 14 Jan 2025
1 answer
42 views

ToolBarItemBase exposes Class and other Parameters via it's inheritance, but dosn't implement them. This causes problems when you want to for example add Class="k-grow" in the ToolBarTemplateItem and TelerikTextBox to make if swell and fill the toolbars remaining space.

Sample Code:

@page "/home"

<TelerikToolBar>
	<ToolBarTemplateItem Class="This-Class-Is-Not-Rendeder-In-Browser-DOM">
		<TelerikTextBox Class="This-Class-Works-Fine" />
	</ToolBarTemplateItem>
</TelerikToolBar>

DOM:

<main class="main" b-29r974uz1l="">
    <div class="k-toolbar telerik-blazor k-toolbar-resizable k-toolbar-md" role="toolbar"
        data-id="e665969e-a55f-4bb1-8503-427f659bc6ab" dir="ltr">
        <div class="k-toolbar-item" tabindex="0">
            <span class="k-textbox k-input This-Class-Works-Fine telerik-blazor k-input-solid k-rounded-md k-input-md">
                <input role="textbox" id="8152979c-ef9b-47f2-9315-acdc5fb5ac38"
                    data-id="a24df6d2-8ce8-4ee3-bd68-3d27283b8bfd" class="k-input-inner" dir="ltr" aria-readonly="false"
                    tabindex="0">
            </span>
        </div>
        <button
            class="telerik-blazor k-button k-toolbar-overflow-button k-hidden k-button-flat k-rounded-md k-button-md k-button-flat-base k-icon-button"
            data-id="1aeae0a0-1a66-404e-914d-2cd4ddba222d" dir="ltr" tabindex="-1" title="More tools"
            aria-disabled="false" type="button">
            <span class="telerik-blazor k-button-icon k-icon k-svg-icon k-svg-i-more-vertical" aria-hidden="true">
                <svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"
                    viewBox="0 0 512 512">
                    <path
                        d="M240 128c26.4 0 48-21.6 48-48s-21.6-48-48-48-48 21.6-48 48 21.6 48 48 48m0 64c-26.4 0-48 21.6-48 48s21.6 48 48 48 48-21.6 48-48-21.6-48-48-48m0 160c-26.4 0-48 21.6-48 48s21.6 48 48 48 48-21.6 48-48-21.6-48-48-48">
                    </path>
                </svg>
            </span>
        </button>
    </div>
</main>

ToolBarTemplateItem.razor from your source code dosn't seem to have any actual implementation for this in the razor file, nor do I see any BuildRenderTree functions in any of the inhertied classes. I assume this is the problem. Or am I missing something?

@namespace Telerik.Blazor.Components

@inherits ToolBarItemBase

Hristian Stefanov
Telerik team
 answered on 13 Jan 2025
2 answers
65 views

Hello
I want to write a desired text instead of calendar numbers.
For example, as specified in the attached file, I want to write the desired text (8 day of month) instead of the number 8.
I tried through the event:
OnCalendarCellRender="@OnCalendarCellRenderHandler"
but I did not get the result.
Please help me.

 

Mohamad Javad
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 13 Jan 2025
1 answer
115 views

Going back to 2020 threads I researched and there is still no way I can tell for easily hiding a GridCommandButton (even when using context)?

What is odd, the "ShowInEdit" will indeed hide the GridCommandButton if row selected and in edit mode ... so it seems  you folks have a way to control visibility but no property for it?

So I'm assuming after 4 years of Blazor UI support, a "visibility" property will NOT happen?

Currently this is what I use to "Enable" a GridCommandButton but that's not really what I want to do, I don't want to show it.

                            <GridCommandColumn Context="bookingEquipmentDeleteCommandContext" Width="8rem">
                                @{
                                    var equipment = bookingEquipmentDeleteCommandContext as BookingEquipmentModel;
                                }
                                <GridCommandButton Command="Delete" OnClick="@EquipmentDeleteCommandHandler" Class="btn-red" Icon="@FontIcon.Trash" Enabled="@(string.IsNullOrEmpty(equipment?.EquipmentCode))" ShowInEdit="false">Delete</GridCommandButton>
                            </GridCommandColumn>

I would think something as simple as "Visible" would be easy to implement, especially now that we're on version 7 on the control suite?

Rob.

Hristian Stefanov
Telerik team
 answered on 10 Jan 2025
1 answer
136 views

I am trying to clear all selected values from a TelerikRadioGroup.  I would like to do this by clicking on the selected value.  The problem is the OnChange and the ValueChanged does not fire unless you are clicking on a different value. 

 

<TelerikRadioGroup Data="@genderOptions"
                   Value="@selectedGender"
                   OnChange="@OnChangeHandler"
                   ValueChanged="@((int newValue) => OnGenderChanged(newValue))"
                   ValueField="@nameof(GenderModel.GenderId)"
                   TextField="@nameof(GenderModel.GenderText)"
                   Layout="RadioGroupLayout.Horizontal">
</TelerikRadioGroup>

 

@code {

private int selectedGender;

private void OnGenderChanged(int newValue)
{
    if (selectedGender == newValue)
    {
        var aa = 123;

    }
    else
    {
        selectedGender = newValue;
        Console.WriteLine($"Gender changed to: {newValue}");


    }

}

async Task OnChangeHandler(object newValue)
{
    // the handler receives an object that you may need to cast to the type of the component
    // if you do not provide a Value, you must provide the Type parameter to the component
    Console.WriteLine($"ValueChanged fired with value: {newValue as string}");
}

}

 

Hristian Stefanov
Telerik team
 answered on 10 Jan 2025
1 answer
64 views

Dear Telerik Support team,

as of version 7.1.0 the No Data Template was introduced for Charts and I was wondering, if there's any chance to prevent the chart of rendering the no data template, when none is defined and needed.

In my case I'd rather display an empty chart, instead of the no data template.

Any way to accomplish that?

Many thanks!
Thomas

Tsvetomir
Telerik team
 answered on 10 Jan 2025
1 answer
134 views
I'd like to add a kebab menu as the last column for each row in my grid that will show a menu of further actions for that row. I found a sample showing how to do a context menu for each row but can't find anything on how to create a custom column with other controls in it (like the DropDownButton).
Marco
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 09 Jan 2025
1 answer
102 views

We have a legacy ASP.NET Core MVC app and are migrating it to Blazor Interactive Server one view/page at a time. We have Blazor Interactive Razor Components in a MVC Razor View working. What is the guidance on the TelerikRootComponent in this scenario? There is no Blazor interactive layout file to place it in w/ this use case.

<div class="alert alert-dark" role="alert">
    This is an ASP.NET Core MVC Razor View/Page.
</div>

<div class="card">
    <div class="card-header">
        Blazor Interactive Server Component
    </div>
    <div class="card-body">
        <component type="typeof(MyWeb.Components.Tests.Test)" render-mode="ServerPrerendered" />
    </div>
</div>

Hristian Stefanov
Telerik team
 answered on 09 Jan 2025
1 answer
137 views

Hi, I am wondering if anyone has attempted this before and if it's possible. I have a use case where a user can click on a grid to expand details about that row, which shows as another grid. For example, in the image I have, I expand this row, and it shows a new grid below.

When I choose export, I want to be able to export the rows I'm viewing as usual, but underneath each of those rows I want to also include the sub-grid rows. 

So for example, if an object has two sub-items in its sub-grid, the export for two objects would look like:

Object 1

        Sub Item 1

        Sub Item 2

Object 2

        Sub Item 1

        Sub item 2

I'm assuming I have to do something under OnBeforeExcelExport to stage this, but how would I go about doing it? I have no idea what the syntax in this case should look like (as a matter of fact I don't quite understand what's going on in the default version of the method). 

Any help is appreciated!

 

Hristian Stefanov
Telerik team
 answered on 08 Jan 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
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
Iron
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?