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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:36:09+00:00 2026-05-18T04:36:09+00:00

I am having difficulty with Html Helpers when used with Razor. Said helpers worked

  • 0

I am having difficulty with Html Helpers when used with Razor. Said helpers worked fine in MVC 2 with the web form view engine. But not in razor. The error I get at runtime is:

Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

Source Error:


Line 1:  @using Wingspan.Web.Mvc;
Line 2:  @Html.IncrementalMenu(MenuBlock.Site)

Expanding the Show Detailed Compiler Output reveals:

d:\...\Views\Shared\MenuTop.cshtml(2,1): error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
d:\...\Views\Shared\MenuTop.cshtml(2,7): error CS1503: Argument 1: cannot convert from 'void' to 'System.Web.WebPages.HelperResult'

That indicates to me that razor doesn’t like my helper, IncrementalMenu, returning void (which works fine in MVC 2 web form engine views).

I get no errors at Compile time, although the line of code (@Html.IncrementalMenu(…)) is red underlined with the following message:

Cannot implicitly convert type 'void' to 'object'

IncrementalMenu is in the Wingspan.Web.Mvc namespace. It’s signature is as follows:

public static void IncrementalMenu(this HtmlHelper html, MenuBlock menuBlock)
{
    // Uses an HtmlTextWriter to render a menu from the sitemap
}

I’m blowed if I know what is wrong…

PS:

The MenuBlock parameter is just an enum that identifies how the menu should render. Don’t fixate on this as that is fine.

  • 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-18T04:36:10+00:00Added an answer on May 18, 2026 at 4:36 am

    You can call your helper like this:

    @{ Html.IncrementalMenu(MenuBlock.Site); }
    

    WebForms syntax

    <% Html.IncrementalMenu(MenuBlock.Site); %>
    

    You just call your method, and the return value (if there is any) is ignored.

    Code like this expects a return value, and writes the return value to the html stream:

    @Html.YourHelper()
    

    Webforms syntax:

    <%: Html.YourHelper() %>
    

    The same, if result value != IHtmlString:

    <%= Server.HtmlEncode(Html.YourHelper()) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand the reason for having the HTML helpers in ASP.NET MVC and extending
I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want
I have been trying to tackle this problem , but I am having difficulty
I am having difficulty setting up a simple html file using javascript to display
This seems like such a simple question, but I'm having such difficulty with it.
I'm having difficulty with building a HTML email. I currently have converted my entire
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
I am having difficulty reliably creating / removing event sources during the installation of
I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I am having difficulty determining if the body of a text email message is

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.