I just discovered that remote validation using the RemoteAttribute will not work unless either:
With the following, MVC throws an InvalidOperationException "No url for remote validation could be found.":
[ActionName("validate-my-widget")]
public virtual JsonResult ValidateMyWidget(string value1, string value2)
{
...
}
Any idea why? I am using T4MVC if that makes a difference.
What is the action name which you are supplying in the Remote
attribute?
If you are supplying the name of your action method (as opposed to the name declared in the ActionName
attribute), then the VirtualPathProvider
will generate a URL using the underlying action method's name. If you supply the name declared in the ActionName attribute, then the URL will be generated using the method name declared in the ActionName attribute.