<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to Homer's ASP.NET Demo
</h2>
<p>The time is <%= DateTime.Now%> or @DateTime.Now</p>
<p>
To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
</p>
U need to download MVC 3 Tools Update inorder t use Razor..bcz Razor comes with MVC 3 and upto MVC 2 we had .aspx as our default view engine.
Correct me if i am wrong!
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
U need to download MVC 3 Tools Update inorder t use Razor
That isn't correct. You can use Razor by downloading WebMatrix and creating a Web Pages site. If you want to use Visual Studio or Visual Web Developer Express to build a Web Pages (Razor) site, you just need to ensure that SP1 is installed.
You do not need to build an MVC site to use Razor, but you cannot use Razor in a Web Forms file.
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
homerallen
Member
5 Points
16 Posts
Razor not working - any idea?
Jul 28, 2012 07:04 PM|LINK
Any idea why @DateTime.Now doesn't work?
see http://asp.homerallen.com
XIII
All-Star
182789 Points
23485 Posts
ASPInsiders
Moderator
MVP
Re: Razor not working - any idea?
Jul 28, 2012 07:33 PM|LINK
Hi,
we can only see the output, not the actual code you're trying out.
I can see a date and hour and the @DateTime.Now.
Likely you typed something like @@DateTime.Now. Can you check?
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
homerallen
Member
5 Points
16 Posts
Re: Razor not working - any idea?
Jul 28, 2012 07:41 PM|LINK
homerallen
Member
5 Points
16 Posts
Re: Razor not working - any idea?
Jul 28, 2012 07:42 PM|LINK
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="Homer_s_ASP._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to Homer's ASP.NET Demo
</h2>
<p>The time is <%= DateTime.Now%> or @DateTime.Now</p>
<p>
To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
</p>
</asp:Content>
Abhishek Luv
Participant
1802 Points
481 Posts
Re: Razor not working - any idea?
Jul 28, 2012 07:45 PM|LINK
U need to download MVC 3 Tools Update inorder t use Razor..bcz Razor comes with MVC 3 and upto MVC 2 we had .aspx as our default view engine.
Correct me if i am wrong!
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Mikesdotnett...
All-Star
155599 Points
19982 Posts
Moderator
MVP
Re: Razor not working - any idea?
Jul 29, 2012 07:14 AM|LINK
Razor doesn't work in aspx pages. You need a file with a .vbhtml extension, or cshtml if you want to work in C#.
Web Pages CMS | My Site | Twitter
Mikesdotnett...
All-Star
155599 Points
19982 Posts
Moderator
MVP
Re: Razor not working - any idea?
Jul 29, 2012 07:21 AM|LINK
That isn't correct. You can use Razor by downloading WebMatrix and creating a Web Pages site. If you want to use Visual Studio or Visual Web Developer Express to build a Web Pages (Razor) site, you just need to ensure that SP1 is installed.
You do not need to build an MVC site to use Razor, but you cannot use Razor in a Web Forms file.
Web Pages CMS | My Site | Twitter
Abhishek Luv
Participant
1802 Points
481 Posts
Re: Razor not working - any idea?
Jul 29, 2012 09:26 AM|LINK
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv