Here is my code:
Why am I getting these errors? 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 JobCosting C:\G\Clients\Oxford Machine & Welding\JobCosting_Identity_June_1\JobCosting\JobCosting\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Pages_Quotations_AddQuotation2_razor.g.cs 240 Active Error CS1503 Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback
Hi Miles,
We suspect that you are using events in the DatePicker component. The issue will produce when we declare wrong arguments to the events. We have added a sample and code snippet for reference.
|
@using Syncfusion.Blazor.Calendars
<SfDatePicker TValue="DateTime?"> <DatePickerEvents TValue="DateTime?" ValueChange="ValueChangeHandler"></DatePickerEvents> </SfDatePicker> @code{
public void ValueChangeHandler(ChangedEventArgs<DateTime?> args) { // Here, you can customize your code. } } |
Documentation : https://blazor.syncfusion.com/documentation/datepicker/events
Let us know if you have faced any problems with the above suggestion and we request you to share the details about your validation logic and use case details elaborately. This will help us to provide you with a better solution.
Regards,
Udhaya Kumar D
So your DatePickerEvents handler works if the date variable is nullable. But it blows up for any variable specified as follows:
<SfDatePicker TValue="DateTime" Placeholder="Quotation Date" @bind-Value="@QuotationDate" ShowClearButton="true" >
<DatePickerEvents TValue="DateTime" OnRenderDayCell="onRenderDayCellHandler"></DatePickerEvents>
</SfDatePicker>
HTH,
Miles
Hi Miles,
In DatePicker,
The Value property is set to null when we click on the clear button. So, setting the null
value to a non-nullable type (DateTime)
the
results in the console exception. So, if you are using the clear button kindly
provide nullable types to the component.
Regards,
Udhaya Kumar D.