Creating And Rendering a View
- Modify the Controller to render a View (please refer the previous post before you do this).
- Right click at word View() and choose Add View
- Leave the devault value and click Add button
- Congratulation, now you have successfully created new view which will be rendered as html when the root / or /Home or /Home/Index url hit
public ViewResult Index() { return View(); }
Now copy this HTML code on the Index.cshtml file.
@{ ViewBag.Title = "Index"; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> </head> <body> <div> Hello World (This is render from the view). </div> </body> </html>
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
0 comments:
Post a Comment