Telerik Forums
UI for Blazor Forum
0 answers
216 views

Hi,

We have a problem at the moment with showing/hiding columns in a grid. With the Column Menu it is possible to show/hide columns.

If a grid has ten columns then it is ten times the identical menu to select columns, which actually makes no sense. 

It would make more sense if there was a way to add a single dropdown menu in the GridToolBar that you can use to hide and show columns. Unfortunately, I have not found an option for this.

You can, of course, assign a bool value to each column and build your own menu, but in an app with dozens of grids and dozens of columns, this is extremely tedious.

We wanted to design our own DropDown element and generate the column selection automatically with a loop over all columns. This is also very cumbersome because the grid doesn't keep the columns as a public property at any point. We currently determine the columns via reflection. Again, it would be nice if there was an easier way. 

Martin
Top achievements
Rank 1
 asked on 21 Mar 2023
1 answer
574 views

I would like my Blazor application to be able to upload PDF Forms (editable PDF documents) for storage that the application will later use by prefilling customer data into them.

The PDFViewer shows an empty PDF when I read in the bytes and display them

I then tried to copy the document using the PdfFormatProvider, on the import it fails.

Code lines:

PdfFormatProvider provider = new PdfFormatProvider();
RadFixedDocument document = new RadFixedDocument();
document = provider.Import(file.OpenReadStream());

Error: Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away.

 

Not sure why the provider does not like these PDF files, also not sure if it is an issue or meant to work.

Nadezhda Tacheva
Telerik team
 answered on 20 Mar 2023
0 answers
85 views

Hello,

is it possible to use the automatically generated columns without an explicit data property?

My thought was to use it the onread databinding as data source.

Thanks in advance.

Marcus

Marcus
Top achievements
Rank 1
Iron
 asked on 20 Mar 2023
1 answer
157 views


<TelerikGrid Data="@Service.ProductSubmissions"
             Resizable="true"
             SelectionMode="GridSelectionMode.Multiple"
             FilterMode="@GridFilterMode.FilterMenu"
             EditMode="@GridEditMode.Inline"
             Height="100%"
             Pageable="true"
             Sortable="true"
             Groupable="false"
             SortMode="@SortMode.Single"
             OnEdit="@GridRowEdit"
             OnCreate="@(async args => await Service.CreateAsync(args))"
             OnUpdate="@(async args => await Service.UpdateAsync(args))"
             @bind-SelectedItems="@Service.SelectedItems"
             @bind-Page="@Service.GridPageIndex"
             PageSize="@Service.GridPageSize"
             PageSizeChanged="@Service.PagerPageSizeChanged"
             @ref="@Grid" >

 on update:


Console.WriteLine("before update request");

                Console.WriteLine($"selected items count before: {SelectedItems.Count()}");

                var updateResponse = await _productSubmissionService.UpdateAsync(
                    new ProductSubmissionUpdateRequestModel(submissionModel, new List<int>(),
                        SelectedItems.Select(_ => _.Id).ToList(), null));

                Console.WriteLine($"selected items count after: {SelectedItems.Count()}");

                Console.WriteLine("update request - done");

                await FinalizeUpdate(updateResponse);

                Console.WriteLine("finalize update");

                Console.WriteLine($"selected items count after 2: {SelectedItems.Count()} | Any {(SelectedItems.Any() ? 1 : 0)}");

                if (SelectedItems.Any())
                {
                    Console.WriteLine("has selected items");

                    //SelectedItems = Enumerable.Empty<ProductSubmissionModel>();

                    await GetSubmissions(_productState.Value.ProductId.Value);

                    Console.WriteLine("reload - done");
                }

await FinalizeUpdate(updateResponse); - just replace updated model

so the sequence:

- have several items selected

- update one item

- reload all data to the grid (according to the doc, if the source if observable (it is public ObservableCollection<ProductSubmissionModel> ProductSubmissions { get; set; }), Selected items collection should be released)

- edit another item (single, grid does not show that any selected (visually))

- but we still see that we have selected, see count before 1,  still have after request, see after 1,  and just after second collection change, the grid has all dataset recalculated & compared & released Selected items, see after update 2

 

so, selected items have to be released after the dataset reload, but it did not happen

var submissions = await _productSubmissionService.GetAsync(productId, _versionId);
            await IfHasFiles(submissions);
            Console.WriteLine("exit GetSubmissions");
            ProductSubmissions = new ObservableCollection<ProductSubmissionModel>(submissions);

 

 

 

 

 

Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
 answered on 17 Mar 2023
0 answers
142 views

Dear Telerik Support Team,

I am a licensed customer from AVEVA and I am reaching out to inquire about how to implement virtualization with continuous scroll in Telerik UI for Blazor using C#. I am specifically interested in the TelerikListView component and would like to implement this feature to improve the performance of my application.

I have already looked through the documentation and examples on your website, but I couldn't find any information on how to achieve virtualization with continuous scroll.

As a valued customer, I would greatly appreciate it if you could provide some guidance or examples on how to implement virtualization with continuous scroll in Telerik UI for Blazor.

Thank you very much for your help in advance.

Best regards,
Anil Kumar Dasari 

Anil Kumar
Top achievements
Rank 1
 asked on 17 Mar 2023
1 answer
383 views

Hi,

when using the DatePicker or DateTimePicker in my project i get the following error when focus is lost in Firefox:

Uncaught (in promise) Error: System.Collections.Generic.KeyNotFoundException: Arg_KeyNotFoundWithKey, inputElementValue
   at System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Text.Json.JsonElement, System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].get_Item(String )
   at Telerik.Blazor.Components.Common.DateInputs.DateInput`1[[System.DateTime, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].DateInput_Focus(Dictionary`2 args)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime , DotNetInvocationInfo& , IDotNetObjectReference , String )
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime , DotNetInvocationInfo , String )

How to reproduce:

I use VS2022 .NET 7, Telerik Blazor 4.1.0
Just create a Blazor WASM Client project. Add the DatePicker. Publish with AOT and run in Firefox. Current culture is set to german.
Simply set the focus on the datepicker, then hit "Tab"-key to switch to another component. Then I get the above error.

When using Chrome, this does not happen. Also tested on different machines. Error occurs only in Firefox.

If you need more information please let me know.

Regards,
Thomas

Thomas
Top achievements
Rank 1
Iron
 answered on 16 Mar 2023
4 answers
703 views

Hi Team,

I am using Telerik Blazor with 3.4.0 version with same base code as https://docs.telerik.com/blazor-ui/knowledge-base/tabstrip-remove-tab.

I am seeing below error while closing tabs. could you please assist for same. Note (i don't see this error when i use 3.2.0)

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at Telerik.Blazor.Components.TelerikTabStrip.FocusActiveTab()
   at Telerik.Blazor.Components.TelerikTabStrip.set_CurrentActiveTabIndex(Int32 value)
   at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[T](MulticastDelegate delegate, T arg)
   at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
Svetoslav Dimitrov
Telerik team
 answered on 16 Mar 2023
0 answers
189 views

Any idea why this would work when running locally but returns "Unauthorized" when running in a Azure Web App?  Using AAD for authentication and the Blazor Upload calls to the same controller work fine.  I tried to get the User Token when the app starts, but it is null.

                HttpClient client = ClientFactory.CreateClient();

                var response = await client.PostAsJsonAsync<UploadDataViewModel>(ToAbsoluteUrl("api/IntUpload/savenotes"), _model);

                if (response.IsSuccessStatusCode)
                {
                    ShowNotification("success", "Notes file was successfully recorded.");
                }
                else
                {
                    ShowNotification("error", "Notes file failed to upload.");
                }

 

This is what I'm using for authentication in the Program.cs file:

builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))

 

 

Chris
Top achievements
Rank 1
 asked on 16 Mar 2023
1 answer
1.6K+ views

Hi

 

After our update to .Net 7, FluentValidation does not work with complex models anymore.

We're using FluentValidation 11.5.1 (latest)

Blazored.FluentValidation 2.1.0 (latest)

I get the error message: Cannot validate instance of type "The Composed Class Type ". Can only validate Instance of Type "Parent Class".

 

Has somebody a solution for this issue?

It worked fine in the previous version.

 

Thank you.

 

Nicolas
Top achievements
Rank 1
Iron
 answered on 16 Mar 2023
1 answer
348 views

I've made a custom FormItem and I need access to the EditContext. This works, but - is there a simpler way to get access to the EditContext?

The Form:


    <TelerikForm
        Model="@AWonderfullModel" 
        OnSubmit="@OnSubmitHandler"
        @ref="@FormRef">
        
        <FormItems > 
            <CascadingValue Name="TheForm" Value="@FormRef">
                @foreach (var row in RexFormItems) 
                {
                    <DynamicComponent Type="@row.Component" Parameters="@row.Parameter"/>
                }
            </CascadingValue>  
        </FormItems>
         .... 
        
    </TelerikForm>


I populate the FormRef via the CascadingValue

and in my CustomControl simple:


  [CascadingParameter]
  public TelerikForm TheForm { get; set; }

....


protected override void OnParametersSet()
{
       Model = TheForm.EditContext.Model;
       ...
}

 

This works well, but we discussed this and there was the Idea, that the Form or the EditContext is reachable in an other way.

 

Dimo
Telerik team
 answered on 16 Mar 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?