Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Turning off validation on a nested blazor custom control

$
0
0

This is for a .NET 8 blazor webapp.

I have a grid that has an Editor Template as follows:

<EditorTemplate>@{    CurrentlyEditedItemSupplier = (context as ItemSupplier)!;<HiSS.Body.Components.Custom.ItemSelector Items="@Items" CurrentItemSupplier="@CurrentlyEditedItemSupplier" Categories="@Categories" /><TelerikValidationTooltip For="@(() => CurrentlyEditedItemSupplier.ItemId)"                                TargetSelector="#Item-field"                                Position="@TooltipPosition.Bottom"></TelerikValidationTooltip>} 

It contains a custom control (ItemSelector) that has 3 comboboxes. The first one is a category selector that filters item records to a smaller subset, the other two are linked to the items and show different fields from them, allowing the user to choose from either an id number or description. The parent grid is bound to an object of type ItemSupplier. This does not contain a Category id that is bound to in the first combobox. The other two are bound to an item id that is in the object.

<TelerikComboBox Id="Category-field" Data="@Categories" @bind-Value="@CurrentCategoryId" TextField="@nameof(Category.Name)" ValueField="@nameof(Category.Id)" OnChange="@FilterItems"                 Width="39%"><ComboBoxSettings><ComboBoxPopupSettings Class="dropdownsize;" /></ComboBoxSettings></TelerikComboBox><TelerikComboBox id="Item-Desc" Data="@FilteredItems" @bind-Value="@CurrentItemSupplier!.ItemId" TextField="@nameof(Item.Description)" ValueField="@nameof(Item.Id)"                        Width="39%"><ComboBoxSettings><ComboBoxPopupSettings Class="dropdownsize;" /></ComboBoxSettings></TelerikComboBox><TelerikValidationTooltip For="@(() => CurrentItemSupplier.ItemId)"                      TargetSelector="#Item-Desc"                          Position="@TooltipPosition.Bottom"></TelerikValidationTooltip><TelerikComboBox id="Item-ItemNo" Data="@FilteredItems" @bind-Value="@CurrentItemSupplier!.ItemId" TextField="@nameof(Item.ItemNo)" ValueField="@nameof(Item.Id)"                    Width="20%"><ComboBoxSettings><ComboBoxPopupSettings Class="dropdownsize;" /></ComboBoxSettings></TelerikComboBox><TelerikValidationTooltip For="@(() => CurrentItemSupplier.ItemId)"                      TargetSelector="#Item-ItemNo"                          Position="@TooltipPosition.Bottom"></TelerikValidationTooltip>

The Category is used purely for filtering the items to give a smaller list to the user. Unfortunately, validation doesn't like it being there as it doesn't exist on the validation model. If I comment out the Category combobox everything works fine, but the item list is too big. How do I get the validation to ignore the Category combobox in the custom control?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>