Skip to content

Instantly share code, notes, and snippets.

@DamianEdwards
Created November 7, 2012 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DamianEdwards/4032153 to your computer and use it in GitHub Desktop.
Save DamianEdwards/4032153 to your computer and use it in GitHub Desktop.
Model binding to a dynamic object using an anon type as the "shape"
public partial class AdHocModelBindingAnonType : System.Web.UI.Page
{
protected dynamic Model { get; private set; }
protected void Page_Load()
{
Model = ModelBindingExecutionContext.Bind(new { FirstName = "" });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment