using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Sleis.Binders { public class CommentBinder : 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 commentType = controllerContext.HttpContext.Request.Params["CommentType"]; modelType = Type.GetType(commentType, true); return base.CreateModel(controllerContext, bindingContext, modelType); } } }