how parse asp.net mvc razor view (cshtml) like html parser in c#

asp.net-mvc-3 c# html-agility-pack html-parsing razor

Question

In c#, I want to parse a razor view file. I also attempted to parse a razor view file using HTML Agility Pack, but it was unable to save the right file contents.

Essentially, I want to use C# to alter certain core HTML components.

<div id="content1">
<p>this contents i want to change </p>
<span>contes</span>
</div>

I would want to alter content1's inner html using C#.

<div id="content1">
    <span>@Function.gethtml()</span>
    </div>

I changed the inner HTML contents using the HTML Agility Pack, but it isn't processing the syntax as it should

The method @Url.Content("abc.css") and others

For further details

In asp.net mvc3, I have developed a project for clothing and shoe stores. I now want to dynamically alter the CSS and HTML. I want to take any template file for HTML with the element id "content1" and extract the inner html from it, then move it to file in cshtml with the element id "content1."

Simply put, I want a parser for razor files that can process both html and razor syntax.

Is there a method to parse the HTML components in the razor view file? Alternative options

0
2
12/10/2012 5:48:16 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow