The workaround will not work since the problem is not limited to DateInputs within grids.
No matter where you use a TelerikDatePicker you cannot type a date starting with zero.
See the duplicated item of this ticket.
If you use the format "dd.MM.yyyy" to get "01.01.2021" users want to type "01012021" but this does not work.
The fastest way to type that date for now is typing "1.1.2021" but users won't use different typing patterns for one digit and two digit days/month.
Please make sure that this bug will be fixed for the next release.
In combination with this bug https://feedback.telerik.com/blazor/1523288-datepicker-won-t-let-the-user-type-in-a-year (because we use "dd.MM.yy" format a lot) typing in DatePicker is more or less impossible.
Regards,
René
Hello,
As a workaround, for the time being you can put the DatePicker in an EditorTemplate (more information on EditorTemplate here: https://docs.telerik.com/blazor-ui/components/grid/templates#edit-template).
<TelerikGrid Data="@Data"
Height="400px"
Pageable="true"
EditMode="@GridEditMode.Inline"
OnUpdate="@UpdateHandler"
Navigable="true">
<GridColumns>
<GridColumn Field="@nameof(MyDataModel.Id)" Title="Id" />
<GridColumn Field="@nameof(MyDataModel.Name)" Title="Name" />
<GridColumn Field="@nameof(MyDataModel.DateOfBirth)" Title="DOB" Width="150px">
<EditorTemplate>
@{
var item = context as MyDataModel;
<TelerikDatePicker @bind-Value="@item.DateOfBirth"></TelerikDatePicker>
}
</EditorTemplate>
</GridColumn>
<GridCommandColumn>
<GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
<GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Save</GridCommandButton>
<GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
</GridCommandColumn>
</GridColumns>
</TelerikGrid>
@code {
public void UpdateHandler(GridCommandEventArgs e)
{
var item = e.Item as MyDataModel;
var index = Data.FindIndex(x => x.Id == item.Id);
if (index != -1)
{
Data[index] = item;
}
}
public List<MyDataModel> Data { get; set; } = Enumerable.Range(1, 20).Select(x => new MyDataModel()
{
Id = x,
Name = $"Name {x}",
DateOfBirth = DateTime.Today.AddDays(-x).Date
}).ToList();
public class MyDataModel
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime DateOfBirth { get; set; }
}
}
Regards,
Svetoslav Dimitrov
Progress Telerik