how to use multiple AdditionalFields in remote validation – asp.net mvc
You could separate them by comma: [Remote(“IsUserNameAvailable”, “User”, AdditionalFields=”LastName,EmailAddress” )]
You could separate them by comma: [Remote(“IsUserNameAvailable”, “User”, AdditionalFields=”LastName,EmailAddress” )]
Using Jon’s suggestion of reflecting through the assembly, here is a snippet you may find useful: using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web.Mvc; public class MvcHelper { private static List<Type> GetSubClasses<T>() { return Assembly.GetCallingAssembly().GetTypes().Where( type => type.IsSubclassOf(typeof(T))).ToList(); } public List<string> GetControllerNames() { List<string> controllerNames = new List<string>(); GetSubClasses<Controller>().ForEach( type => controllerNames.Add(type.Name)); return … Read more
This is somewhat late for an answer but this could help someone (definitely helped me) ASP.NET MVC Pipeline Taken from this great article: An Introduction to ASP.NET MVC Extensibility
I just stumbled on this again after 2 years. I thought ASP.NET MVC 5 had solved this but looks like it’s not the case. So here goes how to solve the problem… Create a class called DecimalModelBinder like the following and add it to the root of your project for example: using System; using System.Globalization; … Read more
var foo = filterContext.Controller.TempData[“foo”];
Based on your error message looks like you are looking for a version that no longer exists and cannot tell which Package source you have selected. I feel like you are looking for version 2.0.0 which is not available in nuget.org repository. The latest one is 2.0.0-rc and it is pre release candidate. Please try … Read more
What happens by default During the controller discovery process, your open generic Controller<T> class will be among the candidate types. But the default implementation of the IApplicationFeatureProvider<ControllerFeature> interface, DefaultControllerTypeProvider, will eliminate your Controller<T> because it rules out any class with open generic parameters. Why overriding IsController() doesn’t work Replacing the default implementation of the IApplicationFeatureProvider<ControllerFeature> … Read more
Tools → Options → Web Forms Designer → Start pages in “Source view”. In VS < 2015 it was called HTML Designer. For other extensions you can define specific behaviour by right clicking on a file and selecting Open With. This allows you to set once off or default behaviour for opening more esoteric file … Read more
I apologize in advance, this post strays a bit from what you asked, but all of this bubbled up when I read your question. WebAPI Matching Semantic The matching semantic used by (the default routes in) WebAPI is fairly simple. It matches the name of the action with the verb (verb = GET? look for … Read more
In .NET 4, The HttpUtility class has a variety of static encoding methods for various contexts, including a JavaScriptStringEncode method for this particular purpose. It’s often simpler to just use JSON deserialization, though.