From 98230cd00c4c8b5010803b495eeb2b921b11610c Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:41:38 +0300 Subject: [PATCH 1/3] docs(Grid): example code polish --- knowledge-base/grid-add-column-from-code.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/knowledge-base/grid-add-column-from-code.md b/knowledge-base/grid-add-column-from-code.md index 8a26f845f..2dc4f76ab 100644 --- a/knowledge-base/grid-add-column-from-code.md +++ b/knowledge-base/grid-add-column-from-code.md @@ -27,13 +27,13 @@ I want to add a custom Grid column programmatically. I would also like to define ## Solution -You can use the [`RenderTreeBuilder`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.rendering.rendertreebuilder?view=aspnetcore-6.0) class to create a GridColumn from the C# portion of the application. +You can use the [`RenderFragment Delegate`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.renderfragment?view=aspnetcore-8.0) to create a GridColumn from the C# portion of the application. >caption Add a GridColumn from code ````CSHTML -@* Use the Render Tree Builder to add a grid column. Click on the Add a column button to see the result *@ +@* Use the RenderFragment to add a grid column. Click on the Add a column button to see the result *@ Add a column @@ -58,15 +58,9 @@ You can use the [`RenderTreeBuilder`](https://docs.microsoft.com/en-us/dotnet/ap private RenderFragment CustomGridColumnFromCode { get; set; } - private RenderFragment AddAGridColumn() => builder => + private RenderFragment AddAGridColumn() => __builder => { - builder.OpenComponent(0, typeof(GridColumn)); - - builder.AddAttribute(0, "Field", "CustomDateField"); //The Field for the Column - builder.AddAttribute(1, "Title", "From code behind"); //The Title for the Column - builder.AddAttribute(2, "DisplayFormat", "{0:dd MMM yy}"); //The DisplayFormat for the Column - - builder.CloseComponent(); + }; public IEnumerable MyData = Enumerable.Range(1, 30).Select(x => new SampleData From 538542bbb2710993f0265d0fe89cc67a3b8ea583 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:51:31 +0300 Subject: [PATCH 2/3] docs(Grid): apply suggestions --- knowledge-base/grid-add-column-from-code.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knowledge-base/grid-add-column-from-code.md b/knowledge-base/grid-add-column-from-code.md index 2dc4f76ab..d6ffb2b7b 100644 --- a/knowledge-base/grid-add-column-from-code.md +++ b/knowledge-base/grid-add-column-from-code.md @@ -27,10 +27,10 @@ I want to add a custom Grid column programmatically. I would also like to define ## Solution -You can use the [`RenderFragment Delegate`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.renderfragment?view=aspnetcore-8.0) to create a GridColumn from the C# portion of the application. +You can use the [`RenderFragment Delegate`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.renderfragment?view=aspnetcore-8.0) to create a `GridColumn` from the C# portion of the application. ->caption Add a GridColumn from code +>caption Add a `GridColumn` from code ````CSHTML @* Use the RenderFragment to add a grid column. Click on the Add a column button to see the result *@ From 746702eb5b9ed50b8609d8145e773490c31fabcc Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:55:50 +0300 Subject: [PATCH 3/3] docs(Grid): caption change --- knowledge-base/grid-add-column-from-code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/grid-add-column-from-code.md b/knowledge-base/grid-add-column-from-code.md index d6ffb2b7b..052f6bc2b 100644 --- a/knowledge-base/grid-add-column-from-code.md +++ b/knowledge-base/grid-add-column-from-code.md @@ -30,7 +30,7 @@ I want to add a custom Grid column programmatically. I would also like to define You can use the [`RenderFragment Delegate`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.renderfragment?view=aspnetcore-8.0) to create a `GridColumn` from the C# portion of the application. ->caption Add a `GridColumn` from code +>caption Add a Grid column from code ````CSHTML @* Use the RenderFragment to add a grid column. Click on the Add a column button to see the result *@