Telerik Forums
UI for Blazor Forum
1 answer
24 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
83 views

On my page I have:

<TelerikCheckBox Id="chkBxIncludeChildren"
                 @bind-Value="@chkBxIncludeChildren_isSelected"
                 Title="Check me off to include this in the data!"                                                
                 Class="tooltip-target"
                 OnChange="@chkBxIncludeChildren_OnClick" />

and I put the following at the bottom of the page:

.k-checkbox {
    /* Make the border a little darker than the default */
    border-color: rgba(0, 0, 0, 0.4) !important;
}

The checkboxes box appears just as i want it.

But I now want that for my whole project. This is were I am having an issue my entry in the app.css seems to be ignored and I am not sure why.

App.css:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <base href="@MyNavigationManager.BaseUri" />

    <link rel="stylesheet" href="bootstrap/bootstrap.min.css" />

    <link rel="stylesheet" href="MarginAnalysis.styles.css" />
    <link rel="icon" type="image/png" href="favicon.png" />
    <HeadOutlet @rendermode="InteractiveServer" />

    @* Telerik Stuff *@
    <script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js"></script>
    <link rel="stylesheet" href="_content/Telerik.UI.for.Blazor/css/kendo-theme-default/all.css" />
    @* Needed for the Telerik 5.0.0 icons! *@
    <link href="https://blazor.cdn.telerik.com/blazor/5.0.0/kendo-font-icons/font-icons.css" rel="stylesheet" type="text/css" />


    <link rel="stylesheet" href="app.css" />
</head>

I put the App.ccs at the end. As far as I understand it that should make it work above teleriks theme css.

What am I missing?

 

Thanks

Deasun.

                
Tsvetomir
Telerik team
 answered on 06 Feb 2025
1 answer
118 views

Whenever I add a TelerkiCheckBox to a page/component the testers complain that they can't see the border of the checkbox so I'm constantly adding the below css to my razor files:

<style>
    .k-checkbox {
        /* Make the border a little darker than the default */
        border-color: rgba(0, 0, 0, 0.4);
    }
</style>

If I add this to my app.css it doesn't get applied.

Is there any way to apply this at a global level?

 

Dimo
Telerik team
 updated answer on 16 Oct 2024
1 answer
170 views

I have a bool property binded in two way to a dialog checkbox.

if i change the check value, the variabile inside the dialog in binded correctly, but the variable binded in the main component in not updated.

 

Check this sample, if i set the check and close the dialog, the parent compoent variable is not updated.

https://blazorrepl.telerik.com/ceuZbwah44LSdBQu06

 

how to solve?

 

Main.Razor

 

@if (IsDialogVisible)
{
   <CheckDialog @bind-CheckValue="CheckValue" OnClose="() => IsDialogVisible = false" />
}
<p>CheckValue is @CheckValue</p>
@code {
    private bool IsDialogVisible {get;set;} = true;
    private bool CheckValue {get;set;}

}

 

CheckDialog.Razor

<TelerikDialog @ref="Dialog" Visible="true" ShowCloseButton="false">
       <DialogContent>
       <TelerikCheckBox @bind-Value="CheckValue" OnChange="() => Dialog.Refresh()" />    
       Check test
       </DialogContent>
     <DialogButtons>
         <TelerikButton OnClick="() => OnClose.InvokeAsync()">Close</TelerikButton>
     </DialogButtons>
</TelerikDialog>
@code {
    private TelerikDialog Dialog {get;set;}
    
    [Parameter]
    public bool CheckValue {get;set;}
    [Parameter]
    public EventCallback<bool> CheckValueChanged {get;set;}
    [Parameter]
    public EventCallback OnClose {get;set;}
}

 

Dimo
Telerik team
 answered on 13 Sep 2024
1 answer
79 views

Hi, I have a object with a collection that I want to bind to checkboxes.

public class JasminUserAdProperties()
{
[Required]
public string Email { get; set; }
[Required]
public string Name { get; set; }

/// <summary>
/// Used for checkboxes
/// </summary>
public List<AdGroupDto> Groups { get; set; } = [];
}

And this is the form / component

@using Zeus.Shared.DTO

<TelerikWindow Width="450px" Centered="true" Visible="@(AdProperties != null)" Modal="true">
<WindowTitle>
<strong>Set Jasmin roles</strong>
</WindowTitle>
<WindowActions>
<WindowAction Name="Close" OnClick="@CancelUpdateJasminRoles"/>
</WindowActions>
<WindowContent>
<TelerikForm Model="@AdProperties" OnValidSubmit="@UpdateJasminRoles">
<FormValidation>
<DataAnnotationsValidator/>
</FormValidation>
<FormItems>
@{
<FormItem>
<Template>
<label for="selectAllCheckbox">Selected All</label>
<TelerikCheckBox Id="selectAllCheckbox"
Value="@SelectAllValue"
ValueChanged="@((bool value) => ValueChanged(value))"
Indeterminate="@SelectAllIndeterminate"/>
</Template>
</FormItem>
foreach (var group in AdProperties.Groups.OrderBy(g => g.Name))
{
<FormItem>
<Template>
<label for="@group.Id">@group.Name</label>
<TelerikCheckBox @bind-Value="@group.Selected" Id="@group.Id" Name="@group.Id"/>
</Template>
</FormItem>
}
}

</FormItems>
<FormButtons>
<TelerikButton Enabled="@CanEdit" ButtonType="ButtonType.Submit" ThemeColor="@ThemeConstants.Button.ThemeColor.Primary">Save</TelerikButton>
<TelerikButton OnClick="@CancelUpdateJasminRoles">Cancel</TelerikButton>
</FormButtons>
</TelerikForm>
</WindowContent>
</TelerikWindow>

@code {

[Parameter] public EventCallback<JasminUserAdProperties> UpdateRoles { get; set; }

[Parameter] public EventCallback CancelUpdateRoles { get; set; }


[Parameter] public JasminUserAdProperties AdProperties { get; set; }

[Parameter] public bool CanEdit { get; set; }


private bool SelectAllValue => AdProperties.Groups.All(eq => eq.Selected);
private bool SelectAllIndeterminate => AdProperties.Groups.Any(eq => eq.Selected);

private void ValueChanged(bool value)
{
AdProperties.Groups.ForEach(eq => { eq.Selected = value; });
}

private void CancelUpdateJasminRoles()
{
if (CancelUpdateRoles.HasDelegate)
{
CancelUpdateRoles.InvokeAsync();
}
}

private void UpdateJasminRoles()
{
if (UpdateRoles.HasDelegate)
{
UpdateRoles.InvokeAsync(AdProperties);
}
}

}

I am getting this error(s) in spades.

blazor.webassembly.js:1  crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Object of type 'Telerik.Blazor.Components.TelerikCheckBox`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' does not have a property matching the name 'Name'.
System.InvalidOperationException: Object of type 'Telerik.Blazor.Components.TelerikCheckBox`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' does not have a property matching the name 'Name'.
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.ThrowForUnknownIncomingParameterName(Type targetType, String parameterName)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
   at Microsoft.AspNetCore.Components.ParameterView.SetParameterProperties(Object target)
   at Telerik.Blazor.Components.Common.TelerikInputBase`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetParametersAsync(ParameterView parameters)
   at Telerik.Blazor.Components.TelerikCheckBox`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetParametersAsync(ParameterView parameters)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)


Have been looking at Bind to nested (navigation) properties in complex objects but its not for lists.

What am I doing wrong?

 

 

 

 

 

 

Nadezhda Tacheva
Telerik team
 answered on 27 May 2024
1 answer
70 views

Can we get a Switch and Checkbox theme color property similar to the rest of the components.

😀

 

 

Dorothy
Top achievements
Rank 1
Iron
 answered on 20 May 2024
1 answer
132 views

Hello,

 

I have a grid filterable with one column with FilterMenuType.CheckBoxList. 

I initialize a defaut filter with OnStateInit which work fine. But when I change the filter by selecting "Select all", nothing is return. It only work when I clear the filter first.

I reproduce the issue here : https://blazorrepl.telerik.com/GokJaiFR56kNGYBW07

Am I doing something wrong with the default filter or is it a bug? I can't find anything related.

 

Thanks in advance

Nansi
Telerik team
 answered on 13 May 2024
1 answer
557 views

Hi,

This seems to effect most telerik components, but if for example using a TelerikCheckBox and the ValueChanged event is an async function, then the error boundry wont catch the exception. This works from basic checkboxes or if not using async.

Example:

<div>
    Telerik checkbox (does NOT display any error): <TelerikCheckBox TValue="bool" ValueChanged="@OnCheck" />
</div>

<div>
    Basic checkbox (displays the error): <input type="checkbox" @onchange="@OnCheck" />
</div>

@{
    async Task OnCheck()
    {
        throw new Exception("Something went wrong!");
    }
}

MainLayout:

<ErrorBoundary>
    <ChildContent>
        <div class="page">
            <div class="sidebar">
                <NavMenu />
            </div>

            <main>
                <div class="top-row px-4">
                    <a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
                </div>

                <article class="content px-4">
                    <TelerikRootComponent>
                        @Body
                    </TelerikRootComponent>
                </article>
            </main>
        </div>
    </ChildContent>
    <ErrorContent>
        ERROR!!!
    </ErrorContent>
</ErrorBoundary>

Dimo
Telerik team
 answered on 14 Feb 2024
1 answer
644 views
How would I create a custom reusable component using Blazor Grid?  I have the following that I'd like to create a component from:

<TelerikGrid    Data="@InitialLendersData"
EditMode="@GridEditMode.Incell"
SelectionMode="@GridSelectionMode.Multiple"
@bind-SelectedItems="@SelectedInitialLenders"
Height="250px"
Width="640px"
OnEdit="@EditInitialLendersHandler"
OnUpdate="@UpdateInitialLendersHandler">
<GridColumns>
<GridColumn Field="@nameof(Lender.IsSelected)" Title="" Width="50px" TextAlign="@ColumnTextAlign.Center" Editable="false">
<Template>
@{
EditedLender = context as Lender;
<TelerikCheckBox @bind-Value="@EditedLender.IsSelected" OnChange="@ChangeSelectedHandler" />
}
</Template>
</GridColumn>
<GridColumn Field="@nameof(Lender.Name)" Editable="false" />
<GridColumn Field="@nameof(Lender.Amount)" Width="160px" DisplayFormat="{0:C2}" TextAlign="@ColumnTextAlign.Right">
<EditorTemplate>
@{
var item = context as Lender;
<TelerikNumericTextBox @bind-Value="@item.Amount" DebounceDelay="0" Min=0 Max=999999999999 Arrows="false" Format="C2" Decimals="2"></TelerikNumericTextBox>
}
</EditorTemplate>
</GridColumn>
</GridColumns>
</TelerikGrid>


How do I pass in the data (InitialLendersData & SelectedInitialLenders) and references to the events (EditInitialLendersHandler, UpdateInitialLendersHandler & ChangeSelectedHandler) from the custom component?  Is this possible? 
Dimo
Telerik team
 answered on 20 Dec 2023
1 answer
289 views
Checkbox shows default tabindex="-1" but would like for users to be able to tab through grid
Dimo
Telerik team
 answered on 19 Oct 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
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
Bronze
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?