@@ -25,23 +25,22 @@ To use a Telerik Date Input for Blazor:
2525```` CSHTML
2626@using Telerik.Blazor.Components.DateInput
2727
28- <TelerikDateInput bind-Value="@dateInputValue" ValueChanged="@MyValueChangeHandler"
29- Format="dd MMMM yyyy" Placeholder="Enter date like 29 March 2019">
28+ <TelerikDateInput Value="@dateInputValue" ValueChanged="@MyValueChangeHandler" Format="dd/MMMM/yyyy">
3029</TelerikDateInput>
3130@result
3231
3332@functions {
34- DateTime dateInputValue { get; set; } = DateTime.Now;
35- string result;
33+ DateTime dateInputValue { get; set; } = DateTime.Now;
34+ string result;
3635
37- private void MyValueChangeHandler(DateTime theUserInput)
38- {
39- Console.WriteLine("entered");
40- result = string.Format("The user entered: {0}", theUserInput);
36+ private void MyValueChangeHandler(DateTime theUserInput)
37+ {
38+ Console.WriteLine("entered");
39+ result = string.Format("The user entered: {0}", theUserInput);
40+
41+ StateHasChanged();
42+ }
4143
42- StateHasChanged();
43- }
44- }
4544````
4645
4746> caption Component namespace and reference
@@ -73,30 +72,26 @@ The date input provides the following features:
7372> caption Example of using validation to prompt the user for certain input
7473
7574```` CSHTML
76- @using Telerik.Blazor.Components.DateInput
77- @using System.ComponentModel.DataAnnotations
78-
7975<EditForm Model="@person">
80- <DataAnnotationsValidator />
81- <ValidationSummary />
82- <TelerikDateInput bind-Value="@person.Birthday" ParsingErrorMessage="plase enter a full date like 29 March 2019"
83- Format="dd MMMM yyyy" Placeholder="Enter date like 29 March 2019">
84- </TelerikDateInput>
85- <ValidationMessage For="@(() => person.Birthday)"></ValidationMessage>
86- <button type="submit">submit</button>
76+ <DataAnnotationsValidator />
77+ <ValidationSummary />
78+ <TelerikDateInput bind-Value="@person.Birthday" ParsingErrorMessage="plase enter a full date like 29 March 2019" Format="dd/MMMM/yyyy">
79+ </TelerikDateInput>
80+ <ValidationMessage For="@(() => person.Birthday)"></ValidationMessage>
81+ <button type="submit">submit</button>
8782</EditForm>
8883
8984@functions{
90- //in a real case, the model will usually be in a separate file
91- public class Person
92- {
93- [Required]
85+ //in a real case, the model will usually be in a separate file
86+ public class Person
87+ {
88+ [Required]
9489 [Range(typeof(DateTime), "1/1/1900", "1/12/2000",
9590 ErrorMessage = "Value for {0} must be between {1:dd MMM yyyy} and {2:dd MMM yyyy}")]
96- public DateTime? Birthday { get; set; }
97- }
91+ public DateTime Birthday { get; set; }
92+ }
9893
99- Person person = new Person();
94+ Person person = new Person();
10095}
10196````
10297
0 commit comments