Telerik Forums
UI for Blazor Forum
2 answers
316 views

I have two Telerik Grid (Summary & Detail Grid). Detail Grid also have child rows. I need to export to excel for both the grid together in a single file with keeping all the formatting (filtering, freezing, sorting etc). Please provide the solution for this implementation with proper example.

 

Nadezhda Tacheva
Telerik team
 answered on 02 Jun 2023
1 answer
572 views

My goal is to have a multi column combo box such that the list changes as the user types in the combo box (by hitting an API) and then when the user clicks one of the items in the drop down I'd like to show the value from one of the columns. I've gotten the first part working but the issue arises when the user clicks on an item.

With the code below what I'm observing is that when the user types in the combo box, the ValueChanged handler fires and gets sent the text the user has typed which allows me to call the API with that value. The drop down displays the data as I expect.  So far so good. Then when the user clicks on an item in the drop down, the ValueChanged handler fires not with the text but with the Id from my model since the ValueField is set to the Id. But I'm also getting an invalid cast error in the browser console. If I change the ValueField to a string, say OrderNumber, the ValueChanged and OnChange handlers fire with the OrderNumber value and I no longer get the error, but the problem is that OrderNumber is not unique so I can't find the distinct item in the collection. So the question is, how do I send the typed text into the ValueChanged handler and send the Id into the OnChange handler? Thanks in advance for your help.


                                <TelerikMultiColumnComboBox Data="_orders"
                                                            AllowCustom="true"
                                                            Value="_selectedOrder"
                                                            ValueExpression="(() => _selectedOrder)"
                                                            ValueChanged="@(async (string order) => await OrderValueChangedAsync(order))"
                                                            OnChange="OrderChangedHandler"
                                                            ValueField="@nameof(OrderDto.Id)"
                                                            TextField="@nameof(OrderDto.OrderNumber)">
                                    <MultiColumnComboBoxColumns>
                                        <MultiColumnComboBoxColumn Field="@nameof(OrderDto.Source)" Title="Source"></MultiColumnComboBoxColumn>
                                        <MultiColumnComboBoxColumn Field="@nameof(OrderDto.DeliverOn)" Title="Deliver On"></MultiColumnComboBoxColumn>
                                        <MultiColumnComboBoxColumn Field="@nameof(OrderDto.OrderNumber)" Title="Order Number"></MultiColumnComboBoxColumn>
                                        <MultiColumnComboBoxColumn Field="@nameof(OrderDto.Suffix)" Title="Suffix"></MultiColumnComboBoxColumn>
                                    </MultiColumnComboBoxColumns>
                                    <MultiColumnComboBoxSettings>
                                        <MultiColumnComboBoxPopupSettings Width="600px" />
                                    </MultiColumnComboBoxSettings>
                                </TelerikMultiColumnComboBox>
private string _selectedOrder;
        private async Task OrderValueChangedAsync(string orderNumber)
        {
            try
            {
                Console.WriteLine($"ValueChanged fired with value {orderNumber}");

                if (orderNumber == null || orderNumber.Length < 5)
                {
                    _orders = new(); // Don't load orders until the user has typed in at least 4 characters so we don't bring back too many orders
                    return;
                }

                if (_activity.Type == "C")
                {
                    _orders = await APIService.CallAPIAsync<List<OrderDto>>($"RMOActivity/GetSalesOrders?orgCode={AppState.SelectedDivision.OrgCode}&orderNumber={orderNumber}", null, HttpMethod.Get);
                }
                else
                {
                    _orders = await APIService.CallAPIAsync<List<OrderDto>>($"RMOActivity/GetPurchaseOrders?orgCode={AppState.SelectedDivision.OrgCode}&purchaseOrderNumber={orderNumber}", null, HttpMethod.Get);
                }
            }
            catch (Exception e)
            {
                LogError("Error loading orders", e);
            }
            finally
            {
                Console.WriteLine($"ValueChanged finished with value {orderNumber}");
            }
        }

        private void OrderChangedHandler(object order)
        {
            try
            {
                Console.WriteLine($"OnChange fired with value {(order == null ? "null" : order.ToString())}");
                if (order != null)
                {
                    _selectedOrder = (string)order;
                }
                Console.WriteLine($"OnChange finished with value {(order == null ? "null" : order.ToString())}");
            }
            catch (Exception e)
            {
                LogError("Error loading order", e);
            }
        }

    public class OrderDto
    {
        public int Id { get; set; }
        public string Source { get; set; }
        public DateOnly? DeliverOn { get; set; }
        public string OrderNumber { get; set; }
        public string Suffix { get; set; }
        public string CustomerOrVendorNumber { get; set; }
        public string ShipToOrVendorCode { get; set; }
    }


Dimo
Telerik team
 answered on 01 Jun 2023
1 answer
183 views

I'm using a TelerikAutoComplete as a filter/searchbox for a Grid. I'm using the OnChange event to call a method that gets the filtered Grid data. It works great until the user clicks the (Add) button to add a new record. At this point, the OnChange event fires again because the OnChange also fires for the OnBlur. 

The effect is that the user clicks the Add button and they see the spinner in the TelerikLoaderContainer for a second or less, and then they have to click the button again to actually fire the event for the button.

I need to move focus away from the AutoComplete after the first OnChange fires, but FocusAsync() doesn't exist for a TelerikGrid or GridCommandButton.

Dimo
Telerik team
 answered on 01 Jun 2023
1 answer
184 views

I am using the tiles from openstreetmap and would like to apply a dark mode theme to the Blazor Map component.  There is mention of using the Sass Theme Builder on the overview page, but the Map is not one of the components listed.

Is this possible?

Thanks for any help on this topic.

Dimo
Telerik team
 answered on 30 May 2023
2 answers
484 views

Hi,

 

Rendering the whole TelerikGrid in Blazor can be slow when there are lots of rows. How do I update the value in a single cell or row, without re-rendering the whole grid?

Nadezhda Tacheva
Telerik team
 answered on 26 May 2023
1 answer
682 views

I am trying to follow https://www.telerik.com/blogs/azure-devops-and-telerik-nuget-packages

but I keep getting error NU1403: Package content hash validation failed for Telerik.Recurrence.Trial.0.2.0. The package is different than the last restore.

This error is generated because my committed packages.lock.json (which is generated by RestorePackagesWithLockFile = true) is somehow different, even though I use the same credentials.

What can I do?

 

Robert
Top achievements
Rank 1
Iron
Iron
 updated answer on 26 May 2023
2 answers
1.2K+ views

I just installed the Blazor UI components following this article: https://docs.telerik.com/blazor-ui/getting-started/server-blazor

I added "@layout TelerikLayout" to MainLayout.razor and I get a build error:

Error CS0246 The type or namespace name 'TelerikLayout' could not be found (are you missing a using directive or an assembly reference?)

The source is Shared_MainLayout_razor.g.cs.  I've tried the typical 'clean & rebuild' as well as restarting VS.  Any suggestions?

Chris
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 26 May 2023
2 answers
273 views

Hi,

I'd like to set the selected items of a treeview from an async method. The values to set come from an web api. So it's an async call.

I tested the case with the provided Telerik sample. With version 2.25 it works. With the latest version selected items are not set within the treeview.

What do I miss?


@page "/"
<TelerikTreeView Data="@FlatData"
                 CheckBoxMode="@TreeViewCheckBoxMode.Multiple"
                 CheckParents="@true"
                 CheckChildren="@true"
                 CheckOnClick="@false"
                 @bind-CheckedItems="@SelectedItems">
    
</TelerikTreeView>

@code {
    List<TreeItem> FlatData { get; set; }
    IEnumerable<object> SelectedItems { get; set; } = new List<object>();
    protected override async Task OnInitializedAsync()
    {
        await GenerateData();
        await SelectDefault();
    }

    async Task SelectDefault()
    {
        await Task.Delay(100);
        SelectedItems = FlatData.Where(data => data.Id == 2);
    }

    async Task GenerateData()
    {
        FlatData = new List<TreeItem>();

        FlatData.Add(new TreeItem()
        {
            Id = 1,
            Text = "Project",
            ParentId = null,
            HasChildren = true,
            Icon = "folder",
            Expanded = true
        });

        FlatData.Add(new TreeItem()
        {
            Id = 2,
            Text = "Design",
            ParentId = 1,
            HasChildren = true,
            Icon = "brush",
            Expanded = true
        });
        FlatData.Add(new TreeItem()
        {
            Id = 3,
            Text = "Implementation",
            ParentId = 1,
            HasChildren = true,
            Icon = "folder",
            Expanded = true
        });
    }

    public class TreeItem
    {
        public int Id { get; set; }
        public string Text { get; set; }
        public int? ParentId { get; set; }
        public bool HasChildren { get; set; }
        public string Icon { get; set; }
        public bool Expanded { get; set; }
    }
}

Rayko
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 26 May 2023
1 answer
144 views

Hi,

I am using TelerikCalendar Blazor component and set its SelectionMode="@CalendarSelectionMode.Multiple".

It works fine on computer as there is CTRL key to hold and click multiple dates to select them.

My question is how to make multi-selection on mobile/touch screen devices. There is no CTRL key.

How does TelerikCalendar support mult-selection on those devices?

Thanks

Kan

Svetoslav Dimitrov
Telerik team
 answered on 26 May 2023
2 answers
115 views
Is it possible to dynamically build the list of FilterFields for a TelerikFilter based on search field data stored in a database? We have complicated nested JSON to search through and so normal IQueryable operations aren't quite yet available to us, we will have to do some massaging of the DataSourceRequests either client or server-side.
Bill
Top achievements
Rank 1
Iron
Iron
 answered on 25 May 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?