Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5943781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:26:41+00:00 2026-05-22T16:26:41+00:00

my question is strictly connected with this one ASP.NET MVC View throwing CS1061 error

  • 0

my question is strictly connected with this one ASP.NET MVC View throwing CS1061 error related to type of model object passed as ViewDdata to a view , but my reputation is to small to add a comment there and when I added my question as an ‘answer’ it was deleted… So please read the question (thread) mentioned above and the answer for it. I followed the steps suggested but it didn’t work for me because of the following errors:

(I will post screenshots to show you both the code and the errors. The names of the variables etc. are changed in comparison to Howiecamp’s code but the rest is the same because it’s the same step in that tutorial.)

Ok so this is what happens when I have “ViewData” in “foreach” loop: screenshot 1

iIf I change it to “Model” like you instructed, suddenly Visual Studio doesn’t understand the “foreach”: screenshot 2

It does understand it if I put “IEnumerable” in the first line like you suggested, however after that it stops recognizing “Html.ActionLink”: screenshot 3: edge.imgur.com/wcgtI.jpg (sorry, as a new user I can post only 2 hyperlinks 😐 )

What should I do in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:26:42+00:00Added an answer on May 22, 2026 at 4:26 pm

    Actually I found my answer in the comments of that article I was referring to at the beginning (I must had been blind not to see it…)

    Sorry everyone for bothering you. But as I took some of your time than maybe I will give also the correct answer for this problem (which gave Benjamin Anderson and if I could I would give him reputation point which are so precious here 🙂 ) so if anyone else followed that tutorial and stuck on the same stage he would find the answer here.

    Apparently the cause of the problem was that Scott was using an older version of MVC at that time. So if you want this to work you have to:

    1) Instead of “ViewData” put “Model”

    Instead of

    foreach (var kategoria in ViewData)
    

    put

    foreach (var kategoria in Model)
    

    2) In the first line you have to add >

    Instead of

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SklepAlfa.Models.Kategorie_produktow>" %>
    

    put

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<SklepAlfa.Models.Kategorie_produktow>>" %>
    

    3) Alter your ActionLink definition!

    Instead of

    <%= Html.ActionLink(category.CategoryName, new { action="List", category=category.CategoryName }) %>
    

    put

    <%= Html.ActionLink(category.CategoryName, "List", new {category= category.CategoryName }) %>
    

    That was the case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this isn't strictly a programming question, but it is related to git.
Not strictly programming-related, but I do not know where else to post this question:
This question is strictly for the Repast Simphony 2.0 mod for Eclipse: My model
This question is not strictly related to Symfony 2, but as I use Symfony
Not strictly a programming question, but definately programming related. The option to run tests
This is strictly an opinion/experience question for research purposes. I was wondering what coding
Disclaimer This is not strictly a programming question, but most programmers soon or later
This isn't strictly a programming question, but I'm asking it here because it's certainly
I know this isn't strictly a programming question but y'all must have experienced this.
I know this isn't strictly speaking a programming question but something I always hear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.