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 6042539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:48:07+00:00 2026-05-23T06:48:07+00:00

i have a project who i migrate to MVC 3 from 2. if i

  • 0

i have a project who i migrate to MVC 3 from 2.

if i write same in fresh MVc 3 project that they are work fine with but my migrated project not worked for this code

 <select id="selrecipetype">
                            @foreach (custom.Type type in rectypes)
                            {
                                <option value="@(type.ID)">@(type.Type)
                                </option>
                            }
                        </select>

Compiler Error Message: CS1525: Invalid expression term ';'
Line 217:                                <option value="@(type.ID)">@(type.Type)
Line 218:                                </option>
Line 219:                            }
Line 220:                        </select>

so what is wrong gone happened in this code.

if i write this this same not worked

@foreach (Categories.Article category in
categories)
{

  • @(category.Name)
  • }

    i want to know why it’s not worked and i got error when work fine if i do in fresh MVC 3 project

    • 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-23T06:48:07+00:00Added an answer on May 23, 2026 at 6:48 am

      Erm, such code doesn’t have to exist, so why care whether it works or not? Not to mention that this <select> doesn’t have a name meaning that other than using javascript the selected value will never be posted to the server. So start by simply selecting this code in the IDE and pressing the Del. button on your keyboard.

      The proper way to generate drop down lists in ASP.NET MVC is using the Html.DropDownListFor helper:

      @Html.DropDownListFor(
          x => x.SomePropertyOnYourViewModelToBindTheResultTo,
          new SelectList(rectypes, "ID", "Type")
      )
      

      or if you don’t have a strongly typed view (which of course you should, but who knows):

      @Html.DropDownList(
          "SomeProperty",
          new SelectList(rectypes, "ID", "Type"),
      )
      
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    i have a MVC based project who is built in MVC2 i migrate them
    I have a friend who was handed off a C#/.NET web project from a
    I have a MVC 1 application who i want to migrate to MVC 3
    I have a project using WCF which was working fine, but I moved the
    For a project I have a series of pseudo-repositories that create XML (they aren't
    So I have to send a java project to someone outside our company who
    I have project Emle in Launchpad . I set it to import from emle.svn.sourceforge.net
    I have project written in Zend Framework and it works fine most of environments.
    I have a project coming up for client who is basically happy with how
    In our organization we have 6 teams: 3 project teams who provide software to

    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.