ASP.NET MVC RemoteAttribute: No url for remote validation could be found
How to configure RemoveAttribute to work with routes like this one?
context.MapExtendedRoute("ValidateSomething",
"some-where/validate/{propName}",
new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey开发者_JAVA技巧" });
When I pass above route name to RemoteAttribute constructor, an InvalidOperationException
occurs. But works just like a charm when there is no propName
in route definitions and parameter passed as querystring.
Thanks in advance;)
You need to add the {propname} parameter to your route, so that you can access it in your controller. In the example below I have made it optional.
context.MapExtendedRoute("ValidateSomething",
"some-where/validate/{propName}",
new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey", propName = UrlParamter.Optional });
精彩评论