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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:36:25+00:00 2026-05-30T19:36:25+00:00

Please see Darin’s solution here .. Converting HTML.EditorFor into a drop down (html.dropdownfor?) I

  • 0

Please see Darin’s solution here .. Converting HTML.EditorFor into a drop down (html.dropdownfor?)

I am not able to make the drop down list work. Can any help with this please. Thank you.

I am getting BC30203 error in my ascx page.

BC30203: Identifier expected. (Line 4 – new[] ).. What do I put in place of model. I tried putting the actual model name and may be I am getting the syntax wrong.. this code goes in the editor template according to the posted solution link above…

Code:

 <%= Html.DropDownList(
    "", 
   new SelectList(
   new[] 
   { 
    new { Value = "true", Text = "Yes" },
    new { Value = "false", Text = "No" },
   }, 
   "Value", 
   "Text",
   Model
  )
  ) %>
  • 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-30T19:36:26+00:00Added an answer on May 30, 2026 at 7:36 pm

    No idea why you are getting such error, the code should work. The following editor template works perfectly fine for me, I have just tested it:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <%= Html.DropDownList(
        "", 
        new SelectList(
            new SelectListItem[] 
            { 
                new SelectListItem { Value = "true", Text = "Yes" },
                new SelectListItem { Value = "false", Text = "No" }
            }, 
            "Value", 
            "Text",
            Model
        )
    ) %>
    

    with the following model:

    public class MyViewModel
    {
        [UIHint("YesNoDropDown")]
        public bool IsActive { get; set; }
    }
    

    controller:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View(new MyViewModel());
        }
    }
    

    and view:

    <%@ Page 
        Language="C#" 
        MasterPageFile="~/Views/Shared/Site.Master" 
        Inherits="System.Web.Mvc.ViewPage<AppName.Models.MyViewModel>" 
    %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
        Home Page
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <%= Html.EditorFor(model => model.IsActive) %> 
    </asp:Content>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see here for a related question . However, char goes to 0xffff (or
Please see my current html snippet is as below. I am trying to make
Please see this: http://jsbin.com/igeqa here, i am simply using alert ( tableObj.childNodes.length ); and
please see: http://jsfiddle.net/4Z4fQ/19/ consider the following html: <a id=myElement href=http://www.google.com/> <img id=image src=http://www.google.com/intl/en_com/images/srpr/logo3w.png alt=google/>
Please see the Image here http://www.tiikoni.com/tis/view/?id=41d9394 As shown there are two sliders on the
Please see designer's picture: Now see what I'm getting: Here is my layout: <LinearLayout
please see follow pic. enter link description here i want when i click on
Please see here for a question I recently asked. The only answer you should
Please see the attached image: 1) I downloaded a new library here: ( http://www.java2s.com/Code/Jar/ABC/Downloadcommonslang24jar.htm
Please see the formulæ below. It's the solution to a circle chord problem where

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.