File tree Expand file tree Collapse file tree 7 files changed +64
-4
lines changed Expand file tree Collapse file tree 7 files changed +64
-4
lines changed Original file line number Diff line number Diff line change 1
- # Samples for ASP.NET Core 6.0 (466 )
1
+ # Samples for ASP.NET Core 6.0 (467 )
2
2
3
- Samples for ASP.NET Core ** 8.0 Preview 3** is available [ here] ( /projects/.net8 ) (4 ).
3
+ Samples for ASP.NET Core ** 8.0 Preview 3** is available [ here] ( /projects/.net8 ) (5 ).
4
4
5
5
Samples for ASP.NET Core ** 7.0** is available [ here] ( /projects/.net7 ) (45).
6
6
Original file line number Diff line number Diff line change 1
- # ASP.NET 8.0 Preview 3 (4 )
1
+ # ASP.NET 8.0 Preview 3 (5 )
2
2
3
3
These samples require [ .NET 8.0 Preview 3] ( https://github.com/dotnet/aspnetcore/blob/main/docs/DailyBuilds.md ) . You will have to install the daily build since Preview 3 is not officially released yet.
4
4
@@ -17,4 +17,8 @@ These samples require [.NET 8.0 Preview 3](https://github.com/dotnet/aspnetcore/
17
17
18
18
* [ RazorComponentThree] ( RazorComponentThree )
19
19
20
- This samples demonstrates rendering a Razor Component from Minimal API via ` RazorComponentResult ` and passing data via anonymous object.
20
+ This sample demonstrates rendering a Razor Component from Minimal API via ` RazorComponentResult ` and passing data via anonymous object.
21
+
22
+ * [ RazorComponentFour] ( RazorComponentFour )
23
+
24
+ This sample demonstrates rendering a Razor Component using ` Html.RenderComponentAsync ` and passing data via anonymous object.
Original file line number Diff line number Diff line change
1
+ <h1 >@Message </h1 >
2
+ @Date
3
+
4
+ @code {
5
+
6
+ [Parameter ]
7
+ public string Message { get ; set ; }
8
+
9
+ [Parameter ]
10
+ public DateOnly Date { get ; set ; }
11
+ }
Original file line number Diff line number Diff line change
1
+ using Microsoft . AspNetCore . Mvc ;
2
+
3
+ var builder = WebApplication . CreateBuilder ( ) ;
4
+ builder . Services . AddMvc ( ) ;
5
+ builder . Services . AddRazorComponents ( ) ;
6
+ var app = builder . Build ( ) ;
7
+
8
+ app . MapControllers ( ) ;
9
+ app . Run ( ) ;
10
+
11
+
12
+ public class HomeController : Controller
13
+ {
14
+ [ Route ( "/" ) ]
15
+ public IActionResult Index ( )
16
+ {
17
+ return View ( ) ;
18
+ }
19
+ }
20
+
Original file line number Diff line number Diff line change
1
+ # Rendering a Razor Component using Html.RenderComponentAsync
2
+
3
+ This sample shows how to render a razor component using ` Html.RenderComponentAsync ` and passing data using anonmyous data.
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
2
+ <PropertyGroup >
3
+ <TargetFramework >net8.0</TargetFramework >
4
+ <ImplicitUsings >true</ImplicitUsings >
5
+ </PropertyGroup >
6
+ </Project >
Original file line number Diff line number Diff line change
1
+
2
+ <!doctype html>
3
+ <html lang =" en" >
4
+ <head >
5
+ <meta charset =" utf-8" >
6
+ <meta name =" viewport" content =" width=device-width, initial-scale=1" >
7
+ <title >Blazor United</title >
8
+ <
link href =
" https://cdn.jsdelivr.net/npm/[email protected] /dist/css/bootstrap.min.css" rel =
" stylesheet" integrity =
" sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin =
" anonymous" >
9
+ </head >
10
+ <body >
11
+ <div class =" container" >
12
+ @( await Html .RenderComponentAsync <RazorComponentFour .Pages .Greetings >(RenderMode .Static ,
13
+ new { Message = " Hello World" , Date = DateOnly .FromDateTime (DateTime .Now ) }))
14
+ </div >
15
+ </body >
16
+ </html >
You can’t perform that action at this time.
0 commit comments