0

I want to load another controller's view using MVC. I do it using something ike return View(~/view/Controller/action);

Now this is a stringly typed view and I am using aspx pages to do that. When it loads, it says that Model is Null. How can I do this?

2
  • How do you mean, ASPX pages ? You want to link to a an MVC view from a standard ASP.Net page ? Commented Sep 11, 2011 at 3:06
  • No, I mean it's not Razor the view is .aspx extension not cshtml Commented Sep 11, 2011 at 4:12

1 Answer 1

1

I think you're looking for this overload of View(). The version you're calling doesn't pass in the Model, resulting in and exception.

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

4 Comments

The model item passed into the dictionary is of type 'TestCase.Models.tblTask', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[TestCase.Models.tblTask]'.
Your view is expecting a list but you are passing in an object that isn't a list
My code is like this: TestCase.Models.tblTask TaskObj = new Models.tblTask(); return View("~view/task/index",TaskObj);
Guys, problem is resolved. I had to pass LINQ query result which is basically a dictionary for that.

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.