0

I created an MVC3 project and use aspx as view engine.

I have Index.aspx which inherits from a partial Index class in codebehind Index.aspx.cs which inherits from System.Web.Mvc.ViewPage<Models.MyModel>

In codebehind IntelliSense doesn't show off any control that exists in front aspx.

Why?

1 Answer 1

2

MVC works differently to the WebForms aspx pages that map asp controls to objects in the code behind. In MVC there is no mapping of front end controls to to back end classes.

Here is some overview on the difference between ASP.NET MVC and WebForms.

Unless I don't understand the question?

Edit:

The Model, populated in the Controller, basically populates the data that can be used directly in the View. There are Model binding techniques that do bind Model properties to form elements. You will need to have a look at a few examples to get your head around this.

Have a look at this tutorial: http://dotnetslackers.com/articles/aspnet/Understanding-ASP-NET-MVC-Model-Binding.aspx

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the Link have started to Read. Still isn't it possible by some hack to make code behind recognize my controls
I think there are ways to mix both MVC and WebForms in the same application, might be worth looking for examples. eg: blogs.taiga.nl/martijn/2009/06/03/…
Thanks for the new link. I marked your answer as right answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.