Thursday, April 25, 2019

Binding custom input to model

Hello I just started learning ASP.NET about 3 days ago. Im building a form right now with a custom datetime picker(flatpickr). Everything is going smoothly except Im not sure how to bind data to my model from my datetime picker without using TextboxFor or EditorFor. Ive searched online for a while without any answers so sorry if this is a dumb question:

My question is, how do i get this:

<input type="text" id="time" placeholder="Select Date.." data-input> // adds the custom datetime picker

from

@Html.EditorFor(model => model.ShowDate, new { @id = "time", @placeholder = "Select Date.." })

Or: How can i bind the original HTML input to model.ShowDate? If I have to create a custom helper how do I do so? I was not able to find anything on this either.

Binding custom input to model Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team