Home Bind input date value to page model Razor
Reply: 0

Bind input date value to page model Razor

user732 Published in March 24, 2018, 2:18 am

I am using razor pages, I want to bind the value of this input to the page model

<input type="date" class="form-input" name="date" id="date" />

Note that I don't have a controller here.

I have tried to add attribute value="@Model.MyDate.date" and define a type for it like this:

public class MyPageModel : PageModel {

 public MyDate Date { get; set; } 
 // use my date value here
public class MyDate
    public string date { get; set; }

but still unable to understand how this binding works, if I want to put this value in TempData or use it in my model or pass it to next view, please help me!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305079 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO