How do I get over my fears of <% %> in my ASP.Net MVC markup?

后端 未结 12 2064
轻奢々
轻奢々 2021-02-04 07:40

So I totally buy into the basic tenents of ASP.NET, testability, SoC, HTML control...it\'s awesome. However being new to it I have a huge hang up with the markup. I know it co

12条回答
  •  Happy的楠姐
    2021-02-04 08:01

    Avoiding tag soup reading might be helpful. Generally you can not use server controls (some might work though), there is no postback or viewstate. I don't think you can use databinding (again there might be exceptions, I'm not sure how ASP.NET MVC treats server controls in the view.) - the easiest method to "databind" something is to pass a list or array of data into the view and use foreach to build HTML out of it.

提交回复
热议问题