Skip to content

Commit

Permalink
partial
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-koshchei committed Jun 15, 2024
1 parent c3f71d9 commit c8cc595
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/mvc/partial.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ public class HomeController
4. Index.cshtml - regular page view, where I demonstrate how to render Partial in Views. As well it contains simple HTMX form to demonstrate usage of Partial as result of Http Post operation.

```html
@model IEnumerable<Item>
<form hx-post="/add-item" hx-target="#items" hx-swap="afterbegin">
<input type="text" name="@nameof(Item.Name)" required />
<input type="number" name="@nameof(Item.Number)" value="0" />
<button type="submit">Submit</button>
</form>

<div id="#items">
@foreach(var item in Model) { @await HomeController.ItemPartial.Render(Html,
item); }
</div></Item
>
@model IEnumerable&lt;Item&gt;

<form hx-post="/add-item" hx-target="#items" hx-swap="afterbegin">
<input type="text" name="@nameof(Item.Name)" required />
<input type="number" name="@nameof(Item.Number)" value="0" />
<button type="submit">Submit</button>
</form>

<div id="#items">
@foreach(var item in Model) { @await
HomeController.ItemPartial.Render(Html,item); }
</div>
```

0 comments on commit c8cc595

Please sign in to comment.