Ranjith Ram
Ranjith Ram

Reputation: 13

ASP.net MVC rendering html pages

I have HTML Pages in my ASP.net MVC project. How can i render these pages with dynamic values.

Index.html

< input type="text" value=<%=Dynamic Value Here%> />

Upvotes: 1

Views: 379

Answers (1)

amurra
amurra

Reputation: 15411

You can't since HTML files will not be parsed by the ASP.NET MVC view engine and it won't understand the server side syntax you will need to insert dynamic values. In order to do this you will need to translate your HTML files into aspx files to use the webforms view engine syntax of <%: %> or cshtml files to use the razor syntax of @. Now you will be able to insert dynamic values since the view engine will insert those values into the HTML that is returned to the browser to be rendered.

Upvotes: 2

Related Questions