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


I want to parse razor view file in c# . I have also used Html Agility Pack to parse razor view file but it failed to save correct file contents.

Basically i want to change some html elements inner html by server side using c#

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

i want to change content1 inner html by c# like this

<div id="content1">

I have used html agility pack to change inner html contents but it is not parsing razor syntax function like

@Url.Content("abc.css") and other function

For more information

I have created a project in mvc3 for shoes and garments shops.Now i want to change css and html dynamically.i want to extract inner html from any html template file where element id will be "content1" and place this inner html in cshtml file where element id is "content1

Simply i want razor file parser that can parse both html and razor syntax like html parser

Is there any way to parse razor view file and it html elements. Any Other solution

Popular Answer

You want to access / modify razor content using server side content.

But MVC is a different way of building websites/applications to webforms.

There are now server side controls or webcontrols. You can use JQuery to do same.

Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why