Telerik Forums
UI for Blazor Forum
1 answer
310 views

This error occurred on 2023-03-15.

 error CS0012: The type 'DataSourceRequest' is defined in an assembly that is not referenced. You must add a reference to assembly 'Telerik.DataSource, Version=2.1.3.0, Culture=neutral, PublicKeyToken=29ac1a93ec063d92'.

[RESOLVED] Error CS0012: The type 'DataSourceRequest' is defined in an assembly that is not referenced. You must add a reference to assembly Telerik.DataSource, Version=2.1.3.0 in UI for Blazor | Telerik Forums

I know it was discussed at this URL.
But when I build the Dockerfile, the error is still there.

When will this error be fixed?

Package : Telerik.UI.Blazor(4.1.0)

Dimo
Telerik team
 answered on 21 Mar 2023
1 answer
382 views

I'm displaying text in a grid cell that contains line feeds and like normal those line feeds get removed when rendered. The conventional wisdom to preserve line feeds is to apply CSS, something like "white-space: pre-wrap". However when I do that in a Telerik grid cell via 

 

.k-grid td, .k-grid .k-table-td {

        white-space: pre-wrap;
}

 

The rendered td element gets unnecessarily tall, wasting space. I saw this post:

https://www.telerik.com/forums/multi-line-text-in-grid-cell

And with that I was able to get the end result to look okay using this:

                <Template>
                    @(new MarkupString((context as LocationDto).RMRAddress?.DisplayText.Replace(Environment.NewLine, "<br/>")))
                </Template>

But I really don't like having to use a markup string like that. Is there a way to apply CSS to the grid cell to preserve the line feeds without creating the unnecessary height? See the attached screenshot. Yellow highlight shows the wasted space I'm referring to.

 

Thanks.

Yanislav
Telerik team
 answered on 21 Mar 2023
1 answer
798 views

I'm running docker-compose up --force-recreate --build and obtaining the following error:

[+] Building 20.8s (17/17) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0                                                  0.2s
 => [ 1/13] FROM mcr.microsoft.com/dotnet/sdk:7.0@sha256:e049e6a153619337ceb4edd040fb60a220d420414d41d6eb39708d6c  0.0s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 9.98MB                                                                                0.1s
 => CACHED [ 2/13] WORKDIR /app                                                                                    0.0s
 => CACHED [ 3/13] RUN apt install -y curl                                                                         0.0s
 => CACHED [ 4/13] RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -                                     0.0s
 => CACHED [ 5/13] RUN apt-get install -y nodejs                                                                   0.0s
 => CACHED [ 6/13] RUN curl -L https://www.npmjs.com/install.sh | sh                                               0.0s
 => CACHED [ 7/13] RUN apt install -y sshpass                                                                      0.0s
 => CACHED [ 8/13] WORKDIR /app                                                                                    0.0s
 => [ 9/13] COPY . .                                                                                               0.3s
 => [10/13] WORKDIR /app/wwwroot                                                                                   0.1s
 => [11/13] RUN npm install                                                                                        9.9s
 => [12/13] WORKDIR /app                                                                                           0.0s
 => ERROR [13/13] RUN dotnet publish -r ubuntu.18.04-x64 -c Release -o ./deploy/release                           10.1s
------
 > [13/13] RUN dotnet publish -r ubuntu.18.04-x64 -c Release -o ./deploy/release:
#0 0.574 MSBuild version 17.5.0+6f08c67f3 for .NET
#0 1.134   Determining projects to restore...
#0 1.137   Skipping project "/monitorix-server/monitorix-server.csproj" because it was not found.
#0 1.139   Skipping project "/monitorix-server/monitorix-server.csproj" because it was not found.
#0 9.653 /app/monitorix-ui.csproj : error NU1101: Unable to find package Telerik.UI.for.Blazor. No packages exist with this id in source(s): nuget.org
#0 9.722   Failed to restore /app/monitorix-ui.csproj (in 8.35 sec).
------
failed to solve: executor failed running [/bin/sh -c dotnet publish -r ubuntu.18.04-x64 -c Release -o ./deploy/release]: exit code: 1
I've included the necessary credentials in NuGet.config at %appdata%/roaming/nuget and the corresponding  package sources with the following feed url https://nuget.telerik.com/v3/index.json:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="Telerik" value="https://nuget.telerik.com/nuget" />
  </packageSources>
    <packageSourceCredentials>
    <Telerik>
        <add key="Username" value="******@******.pt" />
        <add key="ClearTextPassword" value="**********" />
    </Telerik>
  </packageSourceCredentials>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <disabledPackageSources>
    <add key="pbanuget" value="true" />
  </disabledPackageSources>
</configuration>

The following is the .csproj file.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <RootNamespace>monitorix-ui</RootNamespace>
    <UserSecretsId>532751be-63e3-425b-807f-72d212ce24ca</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BlazorMonaco" Version="3.0.0" />
    <PackageReference Include="Telerik.UI.for.Blazor" Version="4.0.1" />
  </ItemGroup>

</Project>

And finally my dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:7.0
# Needed to install the web-ui dependencies
WORKDIR /app
RUN apt install -y curl
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
RUN curl -L https://www.npmjs.com/install.sh | sh

# SSH tools
RUN apt install -y sshpass

# Copy app
WORKDIR /app
COPY . . 

# Install web-ui dependencies
WORKDIR /app/wwwroot
RUN npm install


# dotnet core app restore/build and launch
WORKDIR /app
RUN dotnet publish -r ubuntu.18.04-x64 -c Release -o ./deploy/release

EXPOSE 80
ENTRYPOINT ["./app/deploy/monitorix-ui"]

What seems to be the problem here? Thank you

Dimo
Telerik team
 answered on 21 Mar 2023
1 answer
226 views

Hello,

it seems that selecting multiple items from a filterable MultiSelect can be quite a pain if you want to select items that are filtered. I have adapted the snippet from your documentation to show the problem I'm currently facing with a user request: https://blazorrepl.telerik.com/cRaRPKvP25KEN0xs54 by making the dropdown not close automatically and be Contains filterable.

If the user wants to select all items containing the number 3 from the list it might go something like this: User types 3 into the input box. Multiselect shows items containing 3. User selects an item from the filtered options. Multiselect adds the chosen item to the list of selected items and clears the filter. User now has to type 3 again to filter the multiselect again etc.

So the "clear the filter after user selects item" is the problem here. Is there any way to avoid this, or select multiple items in "one go" from the list of filtered items?

Dimo
Telerik team
 answered on 21 Mar 2023
0 answers
207 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
561 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
83 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
149 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
136 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
376 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
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?