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

  • Home
  • SEARCH
  • 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 607665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:23:03+00:00 2026-05-13T17:23:03+00:00

This extension method does not work on two separate development machines: public static string

  • 0

This extension method does not work on two separate development machines:

public static string DdlTest(this HtmlHelper helper)
{
    var si = new List<SelectListItem>();
    si.Add(new SelectListItem() { Text = "1", Value = "1" });
    si.Add(new SelectListItem() { Text = "2", Value = "2" });
    return helper.DropDownList("test", si, new { Class = "Hey" });
}

I get the following error:

Method not found: ‘System.String System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper, System.String, System.Collections.Generic.IEnumerable`1, System.Object)’.

However, this in-line code does work:

<%
    var si = new List<SelectListItem>();
    si.Add(new SelectListItem() { Text = "1", Value = "1" });
    si.Add(new SelectListItem() { Text = "2", Value = "2" });
%>
<%= Html.DropDownList("test", si, new { Class = "Hey" })%>

Could someone please verify I’m not going crazy!

Please be aware:

It does work in VS2010 and .NET 4 beta 2.

It does work in VS2010 with MVC 2 beta.

It does not work in VS2008 with MVC 1!!

On both machines I have VS2010 beta 2 and VS2008 installed side-by-side.

Am I doing something wrong here?

Edit:

For now I’ve hacked this by disassembling the SelectExtensions class and implementing it myself, which works. Interestingly, in the disassembled code there was an ambiguous method call error.. not sure if this is just the result of reflection though.

Edit 2:

To make the example clearer, suppose this ASPX:

<%
    var si = new List<SelectListItem>();
    si.Add(new SelectListItem() { Text = "1", Value = "1" });
    si.Add(new SelectListItem() { Text = "2", Value = "2" });
%>
<%= Html.DropDownList("test", si, new { Class = "Hey" })%>
<%= Html.TextBox("testing")%>
<%= Html.DdlTest1("test", si, new { Class = "Hey" })%>
<%= Html.DdlTest2("test", si, new { Class = "Hey" })%>
<%= Html.Test3()%>

And this in my extension methods class:

using System.Web.Mvc;
using System.Web.Mvc.Html;

...

public static string DdlTest1(this HtmlHelper helper, string name,
    IEnumerable<SelectListItem> items, object htmlAttributes)
{
    return "Whatever";
}

public static string DdlTest2(this HtmlHelper helper, string name,
    IEnumerable<SelectListItem> items, object htmlAttributes)
{
    return helper.DropDownList(name, items, htmlAttributes);
}

public static string Test3(this HtmlHelper helper)
{
    return helper.TextBox("testing");
}

<%= Html.DropDownList("test", si, new { Class = "Hey" })%> will work
<%= Html.TextBox("testBox")%> will work
<%= Html.DdlTest1() %> will work
<%= Html.DdlTest2() %> will give the following error:

Method not found: ‘System.String System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper, System.String, System.Collections.Generic.IEnumerable`1, System.Object)’.

<%= Html.DdlTest3() %> will give the following error:

Method not found: ‘System.String System.Web.Mvc.Html.InputExtensions.TextBox(System.Web.Mvc.HtmlHelper, System.String)’.

So we can conclude that the ASPX can find my extension methods, and even the normal .NET ones. But when my extensions, in MVC 1, try to call the standard extensions, trouble brews!

Edit 3:

Sigh.

I found the problem, and I suppose in many ways Aaronaught buddy you were right!

I did have the assembly reference in my Web.Config, but I’d missed one tiny detail:

<add assembly=”System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>

It really should have read:

<add assembly=”System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>

I didn’t spot that evil, b*stard 2 in there. I’m sorry peeps, thanks for all your help. Points go to you Aaronaught as you were right after all!

  • 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-13T17:23:03+00:00Added an answer on May 13, 2026 at 5:23 pm

    So clearly my first answer wasn’t related to the problem… but I’m wondering if it’s something else configuration-related. In your web.config you should have this in your <assemblies>:

    <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral,
         PublicKeyToken=31BF3856AD364E35"/>
    

    My next hunch is that you might have either the wrong version or no entry at all, which could be causing it to pick up the MVC 2.0 version from somewhere (GAC perhaps). The application might be trying to call the extension method from MVC 2.0, but passing it an HtmlHelper object compiled against MVC 1.0, which would get you that nonsensical error message.

    In other words maybe it found the method just fine but in the wrong assembly, so the HtmlHelper you need isn’t actually the same HtmlHelper it wants. The method signatures look identical but aren’t quite identical.

    Can you check both your web.config and your Project References in VS2008 and make sure that the version of System.Web.Mvc is the same in both?

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

Sidebar

Ask A Question

Stats

  • Questions 448k
  • Answers 448k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try this: class MyUserChangeForm(UserChangeForm): def __init__(self, *args, **kwargs): super(MyUserChangeForm, self).__init__(*args,… May 15, 2026 at 8:01 pm
  • Editorial Team
    Editorial Team added an answer The best way is to use X11/xlib directly (Documentation: http://tronche.com/gui/x/xlib/… May 15, 2026 at 8:01 pm
  • Editorial Team
    Editorial Team added an answer qr works, but it uses a unique convention and produces… May 15, 2026 at 8:01 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.