Building Rich Input Forms in ASP.NET MVC

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.ย. 2024
  • My online MVC course: learninglineapp... In this video we will explore the powerful features of ASP.NET MVC that allow us to build rich forms that accept user input. We'll begin by discussing the built-in HTML Helpers and Model Binding. Next we'll add validation and show how we can do both client- and server-side validation using DataAnnotations. Finally, we'll see that sometimes using domain models as our form-bound objects doesn't make sense. We'll look at more advanced scenarios using View Models.
    Code download (similar not identical to the video: blog.michaelcke... )

ความคิดเห็น • 25

  • @sergiocakmak
    @sergiocakmak 10 ปีที่แล้ว +3

    thx Michael Kennedy clear and profesional tutorials

  • @avishekhbharati2114
    @avishekhbharati2114 9 ปีที่แล้ว

    Great tutorial. Thumps up!!
    But is your category and book class have relationship or are they independent classes? I made them independent with no relationship. But in BookViewModel when I wrote a property for CategoryID with type ObjectID. I got an error : "Generate class for ObjectID" . I am new to asp.net. Please clear my doubts. :)

  • @UdayShivamurthy
    @UdayShivamurthy 11 ปีที่แล้ว

    Hey Mike, the text becoming all blurry, fuzzy and crazy is only on TH-cam for iPAD. All looks good on a standard pc with a hi-res screen thanks mate!!

  • @zephyrmeme
    @zephyrmeme 10 ปีที่แล้ว +1

    This is really a good tutorial. Thank you Michael !

  • @shainemaguire64
    @shainemaguire64 8 ปีที่แล้ว

    This is awesome stuff, but wondering why you are hard coding the text for the label and not using the HTML helper for LabelFor or DisplayFor which would get the information from the model in the DataAnnotation [DisplayName("XYZ")] or [Display(Name = "XYZ")

  • @dejohnny2
    @dejohnny2 11 ปีที่แล้ว

    This is a really good video and I'm enjoying it. Thanks Michael!

  • @WoundedEgo
    @WoundedEgo 10 ปีที่แล้ว +1

    Kudos, Michael, and thanks.

  • @albxdotcom
    @albxdotcom 10 ปีที่แล้ว +1

    This is not a poke at the presenter, I think you did a fine job. But at 41:55 in the video, it all became clear to me. Basically we now have TWICE the amount of code with MVC, because instead of mapping the control values to a model, now we would create a model, a view model (with similar properties) and we map the properties from the viewmodel to the model. On top of it all, we have additional Controller classes for every table? All this newer technology from Microsoft has me NOT wanting to drink the Kool Aid. Even the razor syntax reminds me of old classic ASP. Maybe I'm totally off base here and a DataTable kind of guy, and someone correct me, but I think Microsoft web tech is moving backwards. WebForms did a great job for years and my helper classes generated all the controls dynamically on my web forms. Somebody please tell me what I'm missing here.

    • @WelcomeToMyDream
      @WelcomeToMyDream 10 ปีที่แล้ว

      MVC isn't just a Microsoft thing. it's a useful pattern in general. The Viewmodel isn't required BTW, and in practice there isn't more code than a properly (separation of concerns) built webforms EF app. Everyone I know who remembers classic ASP loves the very similar yet much more powerful razor syntax and is SO glad to be rid of those clunky controls that spit out HTML we had no control over. Done with the clunky page lifecyle. Done with the ridiculous clunky viewstate junk. MVC is a breath of fresh air for most of us!

    • @slapmyfunkybass
      @slapmyfunkybass 9 ปีที่แล้ว

      ***** the page cycle was not difficult to understand though, I remember many years back learning .net, reading about the page cycle and never forgetting it. Let's be honest it really wasn't that complex. Though I use MVC, I've never understood the whole bloated server controls html code thing they talk about, didn't these people ever go into source view? I used to create all my controls through the source view, and just put in what I needed. If I remember rightly the formview was a html table that you completely wrote, how can that be bloated code?

    • @WelcomeToMyDream
      @WelcomeToMyDream 9 ปีที่แล้ว +1

      slapmyfunkybass Feel free to love Web Forms, not everyone thinks razor is a breath of fresh air, especially those who've always used web forms. Of course you can keep using web forms with MVC, no need to give up something you like. Especially if you don't you don't need control over the HTML output. I do need fine control over the HTML, so I love razor.
      As for the rest, I didn't say the page cycle was complex, or anything about "bloated server controls html code", not sure what your points are there.

  • @shainemaguire64
    @shainemaguire64 8 ปีที่แล้ว

    When you are returning Json, you should be using a JsonResult instead of an ActionResult. :)

    • @mikeckennedy
      @mikeckennedy  8 ปีที่แล้ว +1

      +Shaine MaGuire Hi - if you mean the method signature should be something other than "public ActionResult METHOD(PARAMS) {}" I disagree.
      Yes, usually I'll return Json("..."); but sometimes I might return NotFound(""), or return Redirect("TO LOGIN"), which is impossible without leveraging the base class.
      If I actually returned an ActionResult instance, they yes. (don't remember exactly from the demo)

  • @ericcartmansh
    @ericcartmansh 11 ปีที่แล้ว

    excellent video. Thanks Michael.

  • @mikeckennedy
    @mikeckennedy  11 ปีที่แล้ว

    Hi, sure thing. I'll put it in the comments. BTW, it's not exactly the code but it's close enough.

  • @ayyazkhan8192
    @ayyazkhan8192 4 ปีที่แล้ว +1

    amazing!Thank you

  • @vikaskumarsuman
    @vikaskumarsuman 11 ปีที่แล้ว

    Thanks Michael

  • @UdayShivamurthy
    @UdayShivamurthy 11 ปีที่แล้ว

    Hi mike, thanks ...can't see any text wonder if it TH-cam on iPad that's wrong!

  • @hozae1
    @hozae1 11 ปีที่แล้ว

    The video started great but then I think after the system crash you degraded the video quality due to which the video lags and also degraded the sound quality.

  • @mikeckennedy
    @mikeckennedy  11 ปีที่แล้ว

    Yeah, sorry about that. I couldn't help it.

  • @cryptopunk5959
    @cryptopunk5959 11 ปีที่แล้ว

    Sorry. Give please Source code Amazoon

  • @cryptopunk5959
    @cryptopunk5959 11 ปีที่แล้ว

    Take please Source code shop Amazoon