Articles in this section
Category / Section

How to avoid the error message "CS1502:The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write" having invalid arguments?

3 mins read

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

Reason

The error message above is obtained since .Render() is mentioned in the .cshtml page.

Solution

The parenthesis used in Html helper (“@(Html.EJ“) defines an explicit expression and the curly brackets(“@{Html.EJ“) defines a regular C# code block. The difference is that the explicit expression submits its output directly as a part of the HTML markup and the code block does not submit it directly.

(@(Html.EJ- Returns the MvcHtmlString, so it must be called inside parenthesis.

(“@{Html.EJ- Renders directly to view internally and returns void.

In Essential Studio 12.1.0.43, the HtmlString in Render() method is returned. So it returns null and the Grid does not appear. So in order to avoid the above mentioned error, use parenthesis instead of the curly brackets.

@(Html.EJ().Grid<EJGridSample1.Models.Order>("FlatGrid")
…
.Render())

But in the latest release, Volume 2, 2014 version 12.2.0.36, the Render() method using void return type is updated. The changes made in v12.2.0.36 in the release notes can be tracked using the following links.

Release Notes: http://files2.syncfusion.com/Installs/v12.2.0.36/ReleaseNotes/ASPMVC.html

API Changes Documentation http://help.syncfusion.com/ug/js/default.htm#!documents/apichangesdetails.htm

Online Sample Link

http://mvc.syncfusion.com/demos/web/Grid/Default

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied