You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The assembly requirements depend on component usage, and not on feature usage. For example, both icon assemblies are always required, as our components render icons internally and must be aware of both types of icons. The assemblies, which are related to Excel export, are always required when using a Grid. `Telerik.Recurrence.dll` is required only when using the Scheduler.
64
64
* Move the [`<TelerikRootComponent>`]({%slug rootcomponent-overview%}) to a layout that is used only on pages that have the Telerik assemblies loaded.
65
65
* Lazy loading of assemblies does not support dynamic service injection. As a result, remove the Telerik service registration (`builder.Services.AddTelerikBlazor();`) from `Program.cs`. If you are using [localization for the Telerik Blazor components]({%slug globalization-localization%}), define the the localization service for the Telerik components with the `Localizer` parameter of the `<TelerikRootComponent>`. The key thing is to instantiate the localization service inline. It cannot be injected as a variable from the `@code { }` block, because that will throw runtime errors.
66
66
67
-
````RAZOR
68
-
@using LazyLoadTelerikComponents.Shared.Services
69
67
70
-
<TelerikRootComponentLocalizer="@( new SampleResxLocalizer() )">
71
-
...
72
-
</TelerikRootComponent>
73
-
````
68
+
````RAZOR.skip-repl
69
+
70
+
@using LazyLoadTelerikComponents.Shared.Services
71
+
72
+
73
+
<TelerikRootComponent Localizer="@( new SampleResxLocalizer() )">
74
+
75
+
...
76
+
77
+
</TelerikRootComponent>
78
+
79
+
````
74
80
75
81
Overall, the lazy loading of assemblies at the correct time is a responsibility of the application. If an assembly is not loaded when required, the app will throw `System.IO.FileNotFoundException: Could not load file or assembly ...`. The loading code is in the `OnNavigateAsync` event handler of the `<Router>`. You can also define an optional loading screen inside the `<Router>` with a `<Navigating>` tag.
76
82
@@ -81,11 +87,10 @@ The following tips apply only to .NET 8 and 9 WebAssembly apps:
81
87
* Use `.wasm` instead of `.dll` in the `.csproj` file and the `OnNavigateAsync` event handler.
82
88
*[Register the lazy loader service manually](https://github.com/dotnet/aspnetcore/issues/51966) in the "server" `Program.cs`. Otherwise, you may get a `InvalidOperationException: Cannot provide a value for property 'AssemblyLoader' on type '...Routes'. There is no registered service of type 'Microsoft.AspNetCore.Components.WebAssembly.Services.LazyAssemblyLoader'.`
83
89
84
-
````C#
85
-
using Microsoft.AspNetCore.Components.WebAssembly.Services;
* when deserializing it - don't let the framework deserialize with the registered serialized (Newtonsoft) but take it as a string in the action and deserialize explicitly there with System.Text.Json:
91
89
92
-
**C#**
93
-
94
-
[HttpPost]
95
-
public async Task<DataEnvelope<WeatherForecast>> Post([FromBody] string gridRequestAsString)
Copy file name to clipboardExpand all lines: knowledge-base/common-struct-error.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ res_type: kb
24
24
25
25
When using a data-bound component, the application gets a null exception, and the component does not work. When running the Telerik Blazor application the application gets an error similar to the following:
26
26
27
-
````C#
27
+
````C#.skip-repl
28
28
ArgumentNullException: Value cannot be null. (Parameter 'source')
Copy file name to clipboardExpand all lines: knowledge-base/grid-number-formatting-of-the-csv-export.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ To format numeric and date cells of the exported file before it reaches the clie
51
51
52
52
1. Pass that `MemoryStream` to the `args.Stream` of the `GridAfterCsvExportEventArgs`, so that the modifications can be saved to the actual exported file.
53
53
54
-
````RAZOR
54
+
````RAZOR.skip-repl
55
55
@*Use RadSpreadProcessing to format numeric data in the exported CSV file*@
Copy file name to clipboardExpand all lines: knowledge-base/requires-valueexpression.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,15 +45,15 @@ There are three common ways to resolve such an error:
45
45
* Use two-way binding - the `@bind-Value` syntax if you can. If you wrap our components inside a custom one for your application you need to implement both two-way data binding and `ValueExpression`, read this article for more information: [Validate a Telerik component as child control and apply invalid border ]({%slug inputs-kb-validate-child-component%}). If you need to handle the `ValueChanged` even to implement logic, see this article: [How to handle the ValueChanged event and use forms and validation]({%slug value-changed-validation-model%}). It shows how to use the `ValueExpression` parameter and also hints at using the Telerik-specific `OnChange` event that does not prevent two-way binding.
46
46
* Provide a `ValueExpression` to the component. This is a lambda function that tells the framework what field in the model to update. It is required by the framework when you cannot use `@bind-Value`, but the component is inside a form. The article in the previous point shows an example.
47
47
* You may want to always provide a `ValueExpression` when expecting to reuse input components inside wrapped in a component. This makes them more likely to work when placed inside an `EditForm` from a parent component.
48
-
49
-
**Razor**
50
-
51
-
<TelerikTextBox
52
-
Value="@myModel.MyField"
53
-
ValueExpression="@( () => myModel.MyField )">
54
-
</TelerikTextBox>
55
-
56
-
@* Applies to the other input type components as well *@
57
-
48
+
49
+
````RAZOR.skip-repl
50
+
<TelerikTextBox
51
+
Value="@myModel.MyField"
52
+
ValueExpression="@( () => myModel.MyField )">
53
+
</TelerikTextBox>
54
+
55
+
@* Applies to the other input type components as well *@
56
+
````
57
+
58
58
* Move the `EditForm` inside the component that hosts all the input. This will make it throw the exception immediately, not only when used in a particular case. This will let you evaluate how to solve the situation according to the previous points, and can let you expose only relevant events/logic/parameters to its parents, instead of expecting them to provide a form and validator.
59
59
* If you do not define a `Value` at all, consider whether such an input needs to be in the form in the first place (for example, putting an `<InputText />` in an `EditForm` without defining the value and binding settings will throw the same error.
Copy file name to clipboardExpand all lines: knowledge-base/textbox-select-in-focus.md
+28-27Lines changed: 28 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,36 +32,37 @@ At the time of writing, Blazor does not have native API for handling focus and s
32
32
33
33
1. Prepare a small JavaScript function that will call the [select](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select) method of the input.
34
34
35
-
**JavaScript**
36
-
37
-
<script>
38
-
function selectText(tbId) {
39
-
var tb = document.querySelector("#" + tbId);
40
-
if (tb.select) {
41
-
tb.select();
42
-
}
43
-
}
44
-
</script>
35
+
````JavaScript.skip-repl
36
+
<script>
37
+
function selectText(tbId) {
38
+
var tb = document.querySelector("#" + tbId);
39
+
if (tb.select) {
40
+
tb.select();
41
+
}
42
+
}
43
+
</script>
44
+
````
45
45
46
46
1. Call that function in the desired event like `@focusin`. See how to get such events [here]({%slug inputs-kb-handle-keyboard-events%}).
0 commit comments