Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to cast the object type "System.Web.Mvc.HtmlHelper` 1 [System.Object] "to type" System.Web.Mvc.HtmlHelper "

I'm using DevExpress controlls in my mvc asp.net project. Here is code of View:

<div>
    @Html.DevExpress().TextBox(settings =>
    {
        settings.Name = "TextBox";
        settings.Width = 170;
        settings.Properties.DisplayFormatString = "[ 00 - 00 - 00 ]";
        settings.Text = "123456";
    }).GetHtml()
</div>

and here is error message:

 Unable to cast the object type "System.Web.Mvc.HtmlHelper` 1 [System.Object]" to
 type "System.Web.Mvc.HtmlHelper"

I cant understand where my code is failing, because it's sample code from DevExpress demos.

like image 509
Renat Zamaletdinov Avatar asked Jan 10 '14 11:01

Renat Zamaletdinov


1 Answers

Ty for link, Nitin Varpe. I added this section to my main web.config:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
</assemblyBinding>
</runtime>
like image 69
Renat Zamaletdinov Avatar answered Oct 20 '22 16:10

Renat Zamaletdinov