I’m writing my first asp.net mvc application and I have a question about custom Html helpers:
For making a form, you can use:
<% using (Html.BeginForm()) {%> *stuff here* <% } %>
I would like to do something similar with a custom HTML helper. In other words, I want to change:
Html.BeginTr(); Html.Td(day.Description); Html.EndTr();
into:
using Html.BeginTr(){ Html.Td(day.Description); }
Is this possible?
Here is a possible reusable implementation in c# :
In this case,
BeginTrandEndTrdirectly write in the response stream. If you use extension methods that return a string, you’ll have to output them using :