Question:

Adding Razor code to a web page

by Guest5863  |  12 years, 8 month(s) ago

0 LIKES UnLike

I have a question regarding adding up a Razor code to a web page. Actually I was wondering about the best way to add an URL on a web page using Razor. I have tried myself many times but for some reasons it did not work out. I would really appreciate if someone could guide me step wise that how a razor code can be added to a web page.

 Tags: adding, code, page, razor, Web

   Report

1 ANSWERS

  1. Guest2645

    The following steps are involved for adding up a Razor code to a web page. It should be made sure that none of the following steps should be missed out as it will result in certain errors.

    In reference to the following commands:

    <!DOCTYPE html>


    <html lang="en">

    <head>

    <meta charset="utf-8" />

    <title>Hello World Page</title>

    </head>

    <body>

    <h1>Hello World Page</h1>

    <p>Hello World Page</p>

    </body>

    </html>

    Now add up some razor code to the above command in the way stated below:

    <!DOCTYPE html>


    <html lang="en">

    <head>

    <meta charset="utf-8" />

    <title>Hello World Page</title>

    </head>

    <body>

    <h1>Hello World Page</h1>

    <p>Hello World Page</p>

    <p>The time is @DateTime.Now</p>

    </body>

    </html>

    The page that will be seen on the computer screen contains ordinary HTML markup, with one addition: the @ marked Razor code.

    The Razor code does all the work of determining the current time on the server and display it. As a user, you can specify formatting options; this is just the default.

    By running the page, now you can see the current date and time on the page.

Sign In or Sign Up now to answser this question!

Question Stats

Latest activity: 12 years, 11 month(s) ago.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.