using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Sleis.Models; namespace Sleis.Binders { public class IdentifierBinder : DefaultModelBinder { protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, System.Type modelType) { //Gets IndetifierType key specificed on the Identifiers TAB on UI. Then creates that type of instance associated with the model. var idenType= controllerContext.HttpContext.Request.Params["IdentifierType"]; modelType = Type.GetType(idenType, true); return base.CreateModel(controllerContext, bindingContext, modelType); } } }