area in orchard cms 1.4?

Topics: General, Troubleshooting, Writing modules
Apr 12, 2012 at 4:02 AM

In orchard 1.4 :

Url.Action("GetCountries", "Home", new { area = "2work" })  Error:  Expression cannot contain anonymous types

Help me,please.

Sorry about my English.

Coordinator
Apr 12, 2012 at 4:57 AM

Where do you see that error?

Apr 12, 2012 at 6:04 AM

My VS version : 10.0.40219.1 SP1 Rel.

In a normal application mvc3,I still declare "area" as usual.

In my module,razor view Index.cshtml:

<a href="@Url.Action("GetCountries", "Home", new { area = "2work" })" > ....<a> keyword "new" has error  : Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification

Images Error :

1. http://www.flickr.com/photos/sunrisevietnam/6923727092/

2. http://www.flickr.com/photos/sunrisevietnam/7069807213/

 

Developer
Apr 12, 2012 at 8:01 AM

I've seen this before, and I think it has something to do with Razor. But I believe it's not a runtime error, just some "designer" error, right?

Apr 12, 2012 at 10:28 AM

I fixed it.Thanks for all.

Apr 12, 2012 at 12:29 PM

I have reinstalled VS and still the error http://www.flickr.com/photos/sunrisevietnam/7069807213/

Coordinator
Apr 12, 2012 at 6:39 PM

I have no idea. This should work. I doubt it has anything to do with Orchard by the way, as this is a ASP.NET MVC API. If you still can't make it work, you can use the overload that takes a dictionary.