Is there a lib to simplify html in C # /. NET / ASP.NET

I remember one day when I saw a project that a guy did, where he wrote something like this in some language with json-like strings that created pretty good html. There is something like this that I can use for C # or .NET.

radio-box{ AName, [First|Second|Value:9|ItsLikeAnEnum]}, TextBox[user, password],
Checkbox[RememberMe:true, blah]}  //blah is default which is false
+3
source share
4 answers

If you are using ASP.NET, there is an HTML Agility pack .

He has many helpers for working with HTML. This will not be the same as the format you are describing, but still easier than dealing with raw HTML.

From the website:

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

+3
source

, , , , NHaml? NHaml:

%h1 List of products
%ul
  - foreach (var product in products)
    %li= product.Name 

:

<h1>List of products</h1>
<ul>
    <% foreach (var product in products) %>
        <li>
            <%= product.Name %>
        </li>
    <% } %>
</ul>
+1

If you look at ASP.NET MVC, there are many built-in html helper methods, is that what you mean?

http://www.asp.net/mvc

0
source

Not quite the answer, but there is TagBuilder in Asp.Net MVC .

0
source

Source: https://habr.com/ru/post/1732522/


All Articles