[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# MVC App error

Posted on 2011-10-17
1
Medium Priority
?
193 Views
Last Modified: 2012-05-12
I am new to C# using MVC. I have a simple program that should display a list of items from my database on a webpage. When I launch my web page I get the following error. Please see the files attached.

Server Error in '/' Application.
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[VTask.V_Site]', but this dictionary requires a model item of type 'VTask.Models.Sites'.

When I create the index view I used;

"Create a strongly-typed view".

View data class: VTask.Models.Sites

I can also see the following data class in the list.
VTask.V_Sites
Error-Stack-Trace.txt
Index-Asp.txt
Sites-Aspx.txt
SitesController.txt
0
Comment
Question by:wademi
1 Comment
 
LVL 3

Accepted Solution

by:
Rouneh10 earned 2000 total points
ID: 36984243
You're trying to pass a List<VTask.Models.Sites> into a page that expects a VTask.Models.Sites
Try changing the Index page to inherit from System.Web.Mvc.ViewPage<List<VTask.Models.Sites>> instead.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question