First time at GK Digital?

GK Digital is an online, collaborative learning platform built from the ground up to be a superior learning experience on the web. It is self-paced and supported by instructors and peers. GK Digital is professional training in the 21st century, from Global Knowledge.
Task: Create views in MVC (Razor and C#)

The razor view engine, which first appeared in ASP.NET MVC 3, is massive step forward for web technologies and has become the defacto standard for MVC. Many templating engines (WebForms/ASPX, Python, etc) put the burden on the programmer to to separate code and markup.

Razor is different. It puts the burden on the tooling and allows for smooth and simple transitions with minimal fuss. For example, we could output the time using the following razor syntax:

<span>Welcome, the time is @DateTime.Now.ToShortTimeString()!</span>

And the output would be something like:

Welcome, the time is 12:24 PM!

Being fluent in Razor syntax is a basic requirement of being an MVC developer. That's what this task is all about!

Before you get started, keep in mind that this is only the beginning for Razor. We will cover composite / partial views, layouts, sections, etc. in subsequent tasks. Let's get to it!

System.Web.HttpCompileException (0x80004005): d:\home\site\wwwroot\Views\Tasks\ShowPublic_ContainingCourses.cshtml(19): error CS1502: The best overloaded method match for 'LearningLine.Web.ViewModels.CourseViewModel.CourseViewModel(LearningLine.Mongo.Course, LearningLine.Web.Infrastructure.FullUser, LearningLine.Mongo.UserCompletion, LearningLine.Mongo.Provider[], LearningLine.Mongo.MongoDbDataContext)' has some invalid arguments at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath) at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetCompiledType(String virtualPath) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model) at ASP._Page_Views_Tasks_ShowPublic_cshtml.Execute() in d:\home\site\wwwroot\Views\Tasks\ShowPublic.cshtml:line 94

Preview any course on GK Digital for free.

Just choose a course from our catalog and then press preview course for free.