Telerik Forums
UI for Blazor Forum
0 answers
716 views
I've run into an issue and searched results have yielded a little, but not quite enough information. My project is in blazor server. I am using telerik form components and fluent validation. Is there a global way to prevent the inputs from submitting as you type? I can use the ValidateOn parameter which is fine but when using a <FormItem> component without a <Template> there is no way to do such. Also, i would like the textboxes and other inputs to not bind at all until onblur to prevent excess server calls. In those instances, i can work around it using the DebounceDelay parameter of the textbox but that seems the wrong approach. Finally, with the debounce delay, is it executed on the server or client? Meaning, if i use the DebounceDelay approach is a c# Timer still running and the component still communicating with the server as you type? Thank you in advance for any help or feedback!
Alex
Top achievements
Rank 1
 asked on 25 Sep 2023
1 answer
178 views

I want to have a carousel on my page that fades instead of sliding, but there is no parameter that I can find to set this.

The animation container is able to use a fade animation.  https://demos.telerik.com/blazor-ui/animationcontainer/overview

I would want it to function similarly  to bootstraps version of crossfade. https://getbootstrap.com/docs/5.3/components/carousel/ 

Would I be better off trying to customize the existing carousel component somehow? Could the effect I want be achieved with CSS? Do I need to make a feature request, and where would I do that?

 

Yanislav
Telerik team
 answered on 25 Sep 2023
1 answer
169 views

Good afternoon, everyone.

I've been trying to add a popup for my CRUD operations on my grid, right now I'm only focusing on the "Add" command.

I'll paste the code below:


<TelerikGrid TItem="@MaintenanceCounterpartyModel" OnRead="@GridReadHandler" Pageable="true" Sortable="true" @ref="@GridRef" Id="MA-MaintenanceGrid" EditMode="@Telerik.Blazor.GridEditMode.Popup">
	<GridToolBarTemplate>
		<GridCommandButton Command="ExcelExport" Icon="@FontIcon.FileExcel">Export to Excel</GridCommandButton>
		<span id="search-on-grid" class="k-textbox k-grid-search k-display-flex" style="width: auto; margin-left: 15px;">
			<span class="k-input-icon">
				<span class="k-icon k-i-search"/>
			</span>
			<TelerikTextBox Value="@SearchValue" ValueChanged="@SearchGrid" Placeholder="Search counterparties..." AutoComplete="off" Id="MA-MaintenanceGridToolbarSearch"/>
			<span unselectable="on" class="k-clear-value" title="clear" role="button" tabindex="-1" @onclick="async () => await ClearSearch()">
				<span class="k-icon k-i-x"/>
			</span>
		</span>
		<GridCommandButton Command="Add" Icon="@FontIcon.Plus" Id="M-AddNewCounterParty" Class="k-button k-primary add-counterparty-button">NEW COUNTERPARTY</GridCommandButton>
	</GridToolBarTemplate>
	<GridExport>
		<GridExcelExport FileName="Counterparties" AllPages="true"/>
	</GridExport>
	<GridSettings>
		<GridPopupEditSettings Title="Add new Counterparty">
		</GridPopupEditSettings>
		<GridPopupEditFormSettings>
			<FormTemplate>
                                @{
                                    CPEditItem = context.Item as MaintenanceCounterpartyModel;

                                    <TelerikForm Model="@CPEditItem" OnValidSubmit="@OnValidSubmit">
					<FormValidation>
						<DataAnnotationsValidator/>
					</FormValidation>
					<FormItems>
						<FormItem Field="@nameof(MaintenanceCounterpartyModel.CounterpartyName)"/>
					</FormItems>
					<FormButtons>
						<TelerikButton Icon="@nameof(FontIcon.Save)">Save</TelerikButton>
						<TelerikButton Icon="@nameof(FontIcon.Cancel)" ButtonType="@ButtonType.Button" OnClick="@OnCancel">Cancel</TelerikButton>
					</FormButtons>
				</TelerikForm>
                                }
			</FormTemplate>
		</GridPopupEditFormSettings>
	</GridSettings>
	<GridColumns>
		<GridColumn Title="Counterparty ID" Field="CounterpartyID"/>
		<GridColumn Title="Counterparty Name" Field="CounterpartyName"/>
		<GridColumn Title="Create User" Field="CreateUser"/>
		<GridColumn Title="Create Datetime" Field="CreateDateTime"/>
		<GridColumn Title="Update User" Field="UpdateUser"/>
		<GridColumn Title="Update Datetime" Field="UpdateDateTime"/>
	</GridColumns>
	<DetailTemplate Context="counterparty">
		<TelerikGrid Data="counterparty.LegalEntities">
			<GridColumns>
				<GridColumn Title="Legal Entity ID" Field=@nameof(MaintenanceCounterpartyLegalModel.LegalEntityID)/>
				<GridColumn Title="Legal Entity Name" Field=@nameof(MaintenanceCounterpartyLegalModel.LegalEntityName)/>
				<GridColumn Title="Jurisdiction" Field=@nameof(MaintenanceCounterpartyLegalModel.Jurisdiction)/>
				<GridColumn Title="Create User" Field=@nameof(MaintenanceCounterpartyLegalModel.CreateUser)/>
				<GridColumn Title="Create Datetime" Field=@nameof(MaintenanceCounterpartyLegalModel.CreateDateTime)/>
				<GridColumn Title="Update User" Field=@nameof(MaintenanceCounterpartyLegalModel.UpdateUser)/>
				<GridColumn Title="Update Datetime" Field=@nameof(MaintenanceCounterpartyLegalModel.UpdateDateTime)/>
			</GridColumns>
			<DetailTemplate Context="legalEntity">
				<TelerikGrid Data="legalEntity.RegistrationNumbers">
					<GridColumns>
						<GridColumn Title="Registration Number ID" Field=@nameof(MaintenanceRegistrationNumberModel.RegistrationNumberID)/>
						<GridColumn Title="Registration Type" Field=@nameof(MaintenanceRegistrationNumberModel.RegistrationType)/>
						<GridColumn Title="Registration Number" Field=@nameof(MaintenanceRegistrationNumberModel.RegistrationNumber)/>
						<GridColumn Title="Registration Date" Field=@nameof(MaintenanceRegistrationNumberModel.RegistrationNumber)/>
						<GridColumn Title="Registration Comments" Field=@nameof(MaintenanceRegistrationNumberModel.RegistrationDate)/>
					</GridColumns>
				</TelerikGrid>
			</DetailTemplate>
		</TelerikGrid>
	</DetailTemplate>
</TelerikGrid>

The code works great but when I hit the Add button the popup opens up like this:

And it does not stretch in size to accommodate the fields accordingly. Is there a way to fix this?

Also, is it possible to implement a custom popup if I don't want to use this one? If yes, do we have examples here?

Thanks in advance.

Nahuel
Top achievements
Rank 1
Iron
 answered on 22 Sep 2023
0 answers
184 views

I have a Blazor Server app using TelerikGrid.  The grid has lots of columns and I have FilterMode set to FilterRow and the default filtering works great.  However, since the grid is also set to ScrollMode Virtual, there is no immediate indication of how well the filter is defined.  To fix this I want to display the number of records that are actually "filtered in" in comparison to the total number of records possible so that the user can tell if they've (for example) selected nearly all the records.  

I've looked everywhere and I cannot find a way to ask the grid how many records are currently filtered in.

It seems like I could take the FilterDescriptors, convert them to SQL for a where clause, and run the query every time they change the filter, but that seems like such a waste to essentially run the filter twice every time it reloads.  Even though my dataset is currently small enough that I cache the whole thing on the server, I'm still doing twice the work to get to a number the grid must know.

Here is a snippet from my Razor file:

@code { privateint _filteredCount = 0; // How to set this? } <TelerikGrid Data="@_applications" Pageable="false" Sortable="true" Resizable="true" FilterMode="@GridFilterMode.FilterRow" Width="100%" ScrollMode="@GridScrollMode.Virtual" OnStateInit="(GridStateEventArgs<ApplicationListDTO> args) => StateInitHandler(args)" OnStateChanged="(GridStateEventArgs<ApplicationListDTO> args) => StateChangedHandler(args)" Height="540px" RowHeight="60"> <GridColumns> Column definitions left outfor brevity </GridColumns>

</TelerikGrid> <div class="applicationCount">@(_applications.Count()) applications found, @_filteredCount listed</div>

Suggestions?

Scott
Top achievements
Rank 1
 updated question on 22 Sep 2023
1 answer
257 views

I am trying to create a new project using Telerik C# Blazor Application template in Visual Studio 2022. I am able to go through the template steps however on finish no project is created. The message bar at the bottom of visual studio says it was successful. I have Telerik UI for Blazor Extension installed and enabled.

Misho
Telerik team
 answered on 21 Sep 2023
2 answers
228 views

Is there a way to have a dropdownlist item be a color based on some criteria?

 

 

Hristian Stefanov
Telerik team
 answered on 20 Sep 2023
0 answers
402 views

Hi @all,

I am currently trying to create a TreeDropDownComponent.

so far it works, but I have the problem that it doesn't make sense inside a grid.
I am currently trying to create a TreeDropDownComponent.

so far it works, but I have the problem that it doesn't make sense inside a grid.

Because this component inside the grid cell
and so the popupElement is not above the grid. Does anyone have an idea how I can fix this?

here is my css and code:


@using Telerik.Blazor
@using Telerik.Blazor.Components

<div id="treeSelectorComponent">
    <span class="telerik-blazor k-dropdownlist k-valid k-picker k-picker-solid k-picker-md k-rounded-md"
          onclick="@ToggleDropdown">
        <span class="k-input-inner @( DropDownShown ? "k-state-focused" : "" )">
            <span class="k-input-value-text">@GetSelectedItemsText()</span>
        </span>
        <button class="telerik-blazor k-button k-input-button k-button-solid k-button-md k-button-solid-base k-icon-button"
                type="button">
            <span class="telerik-blazor k-button-icon k-icon k-i-caret-alt-down"></span>
        </button>
    </span>
    <TelerikAnimationContainer @ref="dropdown" Class="k-popup treeView-scrollable-element" >
        <TelerikTreeView Data="TreeItems"
                         SelectionMode="TreeViewSelectionMode.Single"
                         OnItemClick="OnTreeItemClicked">
            <TreeViewBindings>
                <TreeViewBinding ParentIdField="ParentId"
                                 TextField="Text"
                                 IdField="Id">
                    <ItemTemplate>
                        @{
                            TreeItemSelector item = context as TreeItemSelector;
                            <span>@item!.Text</span>
                        }
                    </ItemTemplate>
                </TreeViewBinding>
            </TreeViewBindings>
        </TelerikTreeView>
    </TelerikAnimationContainer>
</div>

@code {
    private bool DropDownShown { get; set; }
    private TelerikAnimationContainer dropdown;

    [Parameter, EditorRequired]
    public List<TreeItemSelector> TreeItems { get; set; } = new List<TreeItemSelector>();
    [Parameter]
    public int TreeId { get; set; } = default!;
    [Parameter]
    public EventCallback<int> TreeIdChanged { get; set; }

    async Task ToggleDropdown()
    {
        DropDownShown = !DropDownShown;
        await dropdown.ToggleAsync();
    }
    string GetSelectedItemsText()
    {
        return TreeItems.FirstOrDefault(p => p.Id == TreeId)?.Text!;
    }

    private async Task OnTreeItemClicked(TreeViewItemClickEventArgs arg)
    {
        var item = arg.Item as TreeItemSelector;
        TreeId = item!.Id;
        if(TreeIdChanged.HasDelegate)
            await TreeIdChanged.InvokeAsync(TreeId);

        await ToggleDropdown();
    }

  public class TreeItemSelector 
  {
      public int Id { get; set; }
      public string Text { get; set; }
      public int? ParentId { get; set; }
      public bool HasChildren { get; set; }
  }
}


#treeSelectorComponent {
    .k-popup {
        &.treeView-scrollable-element{
            overflow-y: auto;
            max-height: 300px;
        }
    }
}

Tino
Top achievements
Rank 1
Iron
 asked on 20 Sep 2023
1 answer
505 views

Hello, good afternoon.

I'm following this page's documentation to build a hierarchy grid. I just copied and pasted the code from the "Expand Rows From Code" example into my project just to see how it works (we are migrating Razor projects to Blazor).

I can see the grid is displayed with the "+" button to expand child grids on each row and even the button to expand all the rows at the top as it is shown in the image below:

Both do nothing, and DetailTemplate doesn't show up.

Some technical stuff:

  • .NET 5
  • The project is an MVC project with Blazor components in it
  • Telerik UI For Blazor 4.5.0 NuGet package
  • Visual Studio 2019
  • I cannot provide a code sample of how my project is structured. Is the company's property.

I hope this helps. I tried following the documentation without success.

Nahuel
Top achievements
Rank 1
Iron
 answered on 19 Sep 2023
0 answers
98 views

I have a TelerikGrid and the TelerikLoader is showing when data is OnRead.

My rows have detail template, that when you expland the row, I want another Loader window displayed while the detail data is retrieved.

I have tried the samples from Telerik but cannot get it to work. Either the Loader does not show at all, OR, I can get it to show and never hide

pls halp

G

George
Top achievements
Rank 1
Iron
Iron
 asked on 19 Sep 2023
1 answer
119 views
The gauge gets smaller if you try to put a label tag before the Gauge
Dimo
Telerik team
 answered on 19 Sep 2023
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?