You are trying to open the view directly and that does not work (visual studio will do that if you for example are having the view as the active document when pressing f5).
just remove the /StartPage/Index from the url and see what happens, hopefully everything will work (if you have set the startpage for the site)
Launching the application from the project level I get a resource cannot be found. I am also still getting the exception on line 7 of my view. I see this in the editor.
here is the code from my startpage model.
using System; using System.ComponentModel.DataAnnotations; using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.DataAnnotations; using EPiServer.SpecializedProperties; namespace MyEPiServerSiteMVC.Models.Pages { [ContentType(DisplayName = "StartPage", GUID = "a14d1a8e-b070-4732-851a-0254c1567b26", Description = "")] public class StartPage : PageData { [CultureSpecific] [Display( Name = "Main body", Description = "The main body will be shown in the main content area of the page, using the XHTML-editor you can insert for example text, images and tables.", GroupName = SystemTabNames.Content, Order = 1)] public virtual XhtmlString MainBody { get; set; } } }
Hi, I think you have a syntax error, you should not have lower cased your property. Instead of m.mainbody, you should have exactly the same property casing as defined on StartPage:
@Html.PropertyFor(m => m.MainBody)
That did not clear the error. Incedently the propery is not showing up via intellisense.
That is strange, are you shore you have build the solution after adding the property?
Do you get the MainBody from intellicense when you are in the controller?
Can you show us how your controller looks like?
Incidently I can edit the start page and clicking view on website returns this link http://localhost:18787/en/start/ and displays the page. However starting the project from the project level in Visual Studio renders this link http://localhost:18787/ Is there addtional configurating needed?
I do get MainBody via intellisense in the controller using currentPage. Here is the controller.
using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using EPiServer; using EPiServer.Core; using EPiServer.Framework.DataAnnotations; using EPiServer.Web.Mvc; using MyEPiServerSiteMVC.Models.Pages; namespace MyEPiServerSiteMVC.Controllers { public class StartPageController : PageController<StartPage> { public ActionResult Index(StartPage currentPage) { /* Implementation of action. You can create your own view model class that you pass to the view or * you can pass the page type for simpler templates */ return View(currentPage); } } }
I was able to figure it out. I went to the Admin, Config and Manage Websites. section and the pervious information I had stored was gone. I re-added my site info and now the start page opens on project build. Thank you for all your assistance.
Great that it work!
hope you have a great time with the rest of the get started steps
I'm using step 3 of the getting started guide. Here I am able to see the start page in CMS edit mode but when I compile the application I get a 404 Error and the page tries to load http://localhost:18787/StartPage/Index I get an error on the index.cshtml page
Error105The type arguments for method 'EPiServer.Web.Mvc.Html.PropertyExtensions.PropertyFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.c:\Users\mcoleman\Documents\Visual Studio 2013\Projects\MyEPiServerSiteMVC\MyEPiServerSiteMVC\Views\StartPage\Index.cshtml74MyEPiServerSiteMVC