SamProf / MatBlazor

Material Design components for Blazor and Razor Components
http://www.matblazor.com
MIT License
2.84k stars 386 forks source link

MatDatePicker cannot bind value against Nullable<DateTime> #226

Open markblomsma opened 4 years ago

markblomsma commented 4 years ago

I'm unable to bind a MatDatePicker to a DateTime?

<MatDatePicker id="activated" @bind-Value="@user.User.Activated" Label="Activated" />

Leads to: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type

novfal commented 4 years ago

you write the propertyto bind public DateTime? ActivatedDate { get; set; } <MatDatePicker id="activated" @bind-Value="@ActivatedDate" Label="Activated" />

markblomsma commented 4 years ago

I'm doing two-way data binding and want the value to be bound to the Activated property of the user. If I try the following it also does not work:

@{ var act = user.User.Activated; } <MatDatePicker id="activated" @bind-Value="@act" Label="Activated" />

image

novfal commented 4 years ago

Using server side or else core hosted blazor in core hosted cant able bind the value directly to related table