Downloads from Building Rich Input Forms in ASP.NET MVC Webcast

Thanks to all who attended my webcast yesterday. Here is the recorded video, slides, and demo application.

Video Recording:

Remember, you’ll need to run MongoDB to make the web app work. Read the readme in the zip file for details (it’s easy!).



  • Hi Michael,

    Happy Holidays from Las Vegas !
    Very instructive hands-on tutorial for MVC Forms.

    A small beef is the unresolved issue with model binding validation for the ( [Required] ) dropdownlist. Sorry it didn’t work out of the box and you mentioned about manual approach without the required attribute, shouldn’t this work ?

    Best, LA Guy

  • Happy Holidays Michael,

    Very nice job with a hands-on walkthrough covering the basic concepts. :)

    As usual, there is a dearth of in-depth videos which cover topics such as below.

    Hope you can comment on how to do Required DropdownList validation using the [Required] attribute instead of a manual validation on the serverside ( as you mentioned ) ?

    Also, would be nice to cover the many to many example where multiple categories could be
    assigned to a book.

    Best, Paul

  • Hi Michael,

    Just in case anyone is interested in getting the Mongo ObjectID ( Guid ) working with the dropdown, then the ViewModel should use a String for the CategoryId and then convert to Mongo

    public class BookViewModel
    //public ObjectId CategoryId { get; set; }
    public string CategoryId { get; set; }
    [Required] public string Name { get; set; }
    [Required] public string ImageUrl { get; set; }
    [Required] public float Price { get; set; }

    +++ VIEW


    Category: @Html.DropDownListFor(m => m.CategoryId, categories)
    Title: @Html.TextBoxFor(m => m.Name)
    Image Url: @Html.TextBoxFor(m => m.ImageUrl)
    Price: @Html.TextBoxFor(m => m.Price)



    public ActionResult AddBook(BookViewModel viewModel)
    if (!ModelState.IsValid)
    ViewBag.CategoriesList = GetCategoriesList();
    return View(viewModel);

    Book book = new Book();

    book.CategoryId = new ObjectId(viewModel.CategoryId); // viewModel.CategoryId;
    book.Name = viewModel.Name;
    book.Price = viewModel.Price;
    book.ImageUrl = viewModel.ImageUrl;


    return Redirect(“/books/show/” + book._id);

    Merry Xmas, Paul

Submit a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s