How to pass proporty of a class define in model as URL action paramter

61 Views Asked by At

I received the following error message:

Compiler Error Message: CS0746: Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.

from the following line:

<a href="@Url.Action((string)ViewBag.RequeryAction, (string)ViewBag.Vertical, new {  filters.size ="medium"})

How can I pass the filter properties to the controller?


I have defined the following types:

class Filters {
     string Layout;
  `  bool onlyBlack
}

class Image {
    Filters filter;
    double height;
}
1

There are 1 best solutions below

1
shf301 On

You can't declare a property name with a dot in it. filter.size is not a valid name.

Use this instead:

<a href="@Url.Action((string)ViewBag.RequeryAction, (string)ViewBag.Vertical, new { filtersSize ="medium"})