MVC 2 Areas not showing up in VS2008 context menu - asp.net-mvc-2

I have converted my ASP.NET web forms project into an MVC project by adding the MVC ProjectType guid in the project file. All of my MVC 2 project items are showing up (View, Controller etc.) but for Areas. I have MVC 2 installed so I'm not sure what's not setup right.

Turns out that an MVC 2 project has a different GUID which makes sense since they are supposed to work side-by-side. I ended up using {F85E285D-A4E0-4152-9332-AB1D724D3325} .
P.S: You have to add this at the start of the element like this:
< ProjectTypeGuids >{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}< /ProjectTypeGuids >
It wouldn't load when I added it at the end (as described in Sanderson's book).

Related

Why VS does not offer creating of MVC Controller using Entitity Framework

I am new to .NET Core and I still trying to get all puzzles together.
One strange thing for me is.
I am using VS2015 CE Update3
When I create new project under
Visual C# -> Web -> ASP.NET Core Web Application
And on next form when I Change Authentication to Individual User Accounts
In my project under Solution Explorer explorer there is context menu on folder Controllers with give me ability to create new Controller using Entity Framework
If I create same project without changing authentication mode.
I do not get ability to create MVC Conntolers using Entity Framework?
Why ?
What I am missing in project whitout autentification to be able to create Scaffold Conntolers and Views
Even if I install Entity Framework using NuGet according to ASP.NET Core Docs for Enitity Framework I still do not get ability to Scarfold MVC Conntolers
My apologies for spamming here on SO.
If I did not asked I will not ever find solution
Looks like this is know issue for .NET Core Preview 2 Visual Studio tooling
There is note on next docs which I did not not reach because I stacked on line bofore
Don't miss setting authentication to Individual User Accounts. You
won't be using authentication in this tutorial, but you need to enable
it because of a limitation of .NET Core Preview 2 Visual Studio
tooling. Scaffolding for MVC controllers and views only works when
Individual User Accounts authentication is enabled.

Asp.Net MVC 2 model binding with ASPNetSpell textbox

How can I bind some data from my model into an ASPNetSpell textbox?
<ASPNetSpell:SpellTextBox ID="SpellTextBox1" runat="server">Some text to spell check</ASPNetSpell:SpellTextBox>
Looks like that it is server control and you can't use it in the ASP.NET MVC.
You can find out about some of the spell checkers for asp.net mvc project there or there or there.
UPDATE: You catch me. It works. I checked official site not careful in previous time. Did you check in the "how to" samples?
Getting Started with ASPNetSpell
ASPNetSpell & MVC
ASPNetSpell and the .Net Razor Framework

View Engine dropdown not present while adding view

I am creating MVC music store application by reading the PDF, in that on page 22 there is a method shown to add view but when I right clicked on it I am getting the below screen:
[Why I am not getting the View Engine Drop Down?]
Razor doesn't work in ASP.NET MVC 2 that's why you are not provided with this choice. You could use Visual Studio 2010 with ASP.NET MVC 3 installed. Only in ASP.NET MVC 3 projects you are provided with this choice.
This is for MVC 3 only. It seems you are using MVC 2.
Install Visual Web Developer Express 2010 as per section:
File -> New Project
Installing the software
This will give you the IDE used in this tutorial and allow you to view the ASP.Net MVC3 tooling options such as presented in the dialogue box.

ASP.NET MVC - Simple Breadcrumbs (SiteMap)

I have developed a ASP.NET MVC 2 application and I want to put a simple breadcrumbs (sitemap) in each page like this:
Home > Movies > Details
It is equal the URL: http://localhost/home/movies/details
How can I achieve it? I would like to put it in my master page.
Thanks!
I would recommend using MVCSiteMapProvider. It's available as a NuGet package.
It can be used to generate breadcrumbs (which you are probably asking about) and also site maps.
MvcSiteMapProvider is, as the name
implies, an ASP.NET MVC
SiteMapProvider implementation for the
ASP.NET MVC framework. Targeted at
ASP.NET MVC 2, it provides sitemap XML
functionality and interoperability
with the classic ASP.NET sitemap
controls, like the SiteMapPath control
for rendering breadcrumbs and the Menu
control.
Based on areas, controller and action
method names rather than hardcoded URL
references, sitemap nodes are
completely dynamic based on the
routing engine used in an application.
The dynamic character of ASP.NET MVC
is followed in the MvcSiteMapProvider:
there are numerous extensibility
points that allow you to extend the
basic functionality offered.
If it is always equal to the URL, the absolute simplest thing would be to make use of that by using something like this:
var menuitems = Request.Url.AbsolutePath.Split("/".ToCharArray(),
StringSplitOptions.RemoveEmptyEntries);
menuitems would now contain the menu items you need to perform a simple foreach loop and build your menu.

mvc 2 using Codebehind instead of precompiled dll

How do I run my mvc 2 web application using the code-behind classes rather than the generated dll it creates when compiling ?
The reason for this is so I can update an Action in a controller for example via the .cs file rather than having to redeploy a new dll for the whole site.
Similar to how you could have websites in asp.net 2 webforms rather than web applications
ASP.NET MVC uses ASP.NET application instead of ASP.NET website so what you are asking is not possible. The application needs to be precompiled before deployment.
Now this being said you could in fact you a web site as model for ASP.NET MVC application but be prepared to do everything manually.
Create a new ASP.NET website
In the special App_Code folder add a controller
Add the Views folder containing the corresponding web.config, layout and views
Configure your routes in Global.asax
So you need to put all your code behind (controllers, models, ...) in the special App_Code folder.