Unable to MudDatePicker how to bind it to a Datamodel

Viewed 314
<EditForm Model="@_newRegister" OnValidSubmit="@HandleValidSubmit">
  <DataAnnotationsValidator />
  <ValidationSummary />
  <div class="container-fluid">
    <div class="row">
     <div class="col-6">
      <div class="form-group">
        <MudDatePicker Label="Collection Date" Editable="true" @bind-Date="_newRegister.CollectionDate" />
      </div>
     </div>
    </div>
  </div>
</Editform>

@code{
private Register _newRegister = new x.Shared.Register
{
    ProcessingDate = DateTime.Today,
    CollectionDate = DateTime.Today,
    ModifiedDate = DateTime.Today,
    CreateDate = DateTime.Today
};

private string Success = "";
DateTime? date = DateTime.Today;

public void HandleValidSubmit()
{

    Success = "Success";

}
)

public class Register
{
    [Key]
    public int ID { get; set; }
    public String CustomerName { get; set; }
    public DateTime CollectionDate { get; set; }
    public DateTime ProcessingDate { get; set; }
    public String Location { get; set; }
    public String Remarks { get; set; }
    public String Reference { get; set; }
    public int Type { get; set; }

}

'''

i am getting this error .. if i use a local datetime variable (date) this error is gone, however i am not able to mapp that to the model anymore .. Any solution how to do i bind the model on this

Error CS1662 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 X.Client

Error CS1503 Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.DateTime>' to 'Microsoft.AspNetCore.Components.EventCallback' x.Client D:\x\Client\obj\Debug\net5.0\Razor\Pages\CashRegister\AddRegister.razor.g.cs 174 Active

Error CS1503 Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.DateTime>' to 'Microsoft.AspNetCore.Components.EventCallback' D:\x\Client\Pages\CashRegister\AddRegister.razor
Error CS1662 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 D:\x\Client\Pages\CashRegister\AddRegister.razor

1 Answers
Related