Skip to content

Commit f555db9

Browse files
docs(common): simplify overview examples for inputs; events will be on separate pages
1 parent 60811bc commit f555db9

File tree

5 files changed

+23
-92
lines changed

5 files changed

+23
-92
lines changed

_contentTemplates/common/issues-and-warnings.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#generic-component-event-issue
2-
>warning [.NET Core Issue 8385](https://github.com/aspnet/AspNetCore/issues/8385) is preventing the ValueChanged handler from working at the moment. The code below will work as soon as Microsoft release a fix for this problem. Until then, you may get compilation issue due to the handler presence. We strive to follow best practices and future-proof our components, which is why we are using this approach even though it does not work yet.
3-
#end
4-
51

62
#mono-linker-issue
73
Open the Client `.csproj` file and ensure that the following switch is present. At the moment the IL Linker needs to be disabled because of [an issue in Mono](https://github.com/mono/mono/issues/12917).

components/dateinput/overview.md

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,21 @@ The Date Input component allows the user to enter a date. The developer can cont
1414

1515
To use a Telerik Date Input for Blazor, add the `TelerikDateInput` tag.
1616

17-
>caption Basic date input with its key features, and ValueChanged event handling
18-
19-
@[template](/_contentTemplates/common/issues-and-warnings.md#generic-component-event-issue)
17+
>caption Basic date input with namespace and reference
2018
2119
````CSHTML
2220
@using Telerik.Blazor.Components.DateInput
2321
24-
<TelerikDateInput Value="@dateInputValue" ValueChanged="@MyValueChangeHandler" Format="dd/MMMM/yyyy">
22+
<TelerikDateInput @bind-Value="@dateInputValue" Format="dd/MMMM/yyyy" @ref="theDateInput">
2523
</TelerikDateInput>
26-
@result
24+
@dateInputValue
2725
2826
@code {
2927
DateTime dateInputValue { get; set; } = DateTime.Now;
30-
string result;
31-
32-
private void MyValueChangeHandler(DateTime theUserInput)
33-
{
34-
Console.WriteLine("entered");
35-
result = string.Format("The user entered: {0}", theUserInput);
36-
37-
StateHasChanged();
38-
}
39-
}
40-
````
41-
42-
>caption Component namespace and reference
43-
44-
````CSHTML
45-
@using Telerik.Blazor.Components.DateInput
46-
47-
<TelerikDateInput @ref="theDateInput" @bind-Value="dateInputValue"></TelerikDateInput>
48-
49-
@code {
50-
Telerik.Blazor.Components.DateInput.TelerikDateInput theDateInput;
5128
52-
DateTime dateInputValue { get; set; } = DateTime.Now;
29+
Telerik.Blazor.Components.DateInput.TelerikDateInput<DateTime> theDateInput;
30+
// the type of the component depends on the type of the value
31+
// in this case it is DateTime, but it could be DateTime?
5332
}
5433
````
5534

components/datepicker/overview.md

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,26 @@ The Date Picker component allows the user to choose a date from a visual list ([
1414

1515
To use a Telerik Date Picker for Blazor, add the `TelerikDatePicker` tag.
1616

17-
>caption Basic date picker with its key features, and ValueChanged event handling
18-
19-
@[template](/_contentTemplates/common/issues-and-warnings.md#generic-component-event-issue)
17+
>caption Basic date picker with namespace and reference
2018
2119
````CSHTML
2220
@using Telerik.Blazor.Components.DatePicker
2321
24-
<TelerikDatePicker @bind-Value="datePickerValue" ValueChanged="@ValueChanged"></TelerikDatePicker>
22+
<TelerikDatePicker @bind-Value="datePickerValue" @ref="theDatePicker"></TelerikDatePicker>
2523
26-
<br />The selected date is: @selectedDate?.ToShortDateString()
24+
<br />The selected date is: @datePickerValue.ToShortDateString()
2725
2826
@code {
29-
DateTime datePickerValue = DateTime.Now;
30-
private DateTime? selectedDate;
31-
32-
protected void ValueChanged(DateTime newValue)
33-
{
34-
selectedDate = newValue;
35-
//you can, alternatively, use the datePickerValue variable because it is bound
36-
}
27+
DateTime datePickerValue { get; set; } = DateTime.Now;
28+
29+
Telerik.Blazor.Components.DatePicker.TelerikDatePicker<DateTime> theDatePicker;
30+
// the type of the component depends on the type of the value
31+
// in this case it is DateTime, but it could be DateTime?
3732
}
3833
````
3934

4035
![](images/datepicker-first-look.png)
4136

42-
>caption Component namespace and reference
43-
44-
````CSHTML
45-
@using Telerik.Blazor.Components.DatePicker
46-
47-
<TelerikDatePicker @ref="theDatePicker">
48-
</TelerikDatePicker>
49-
50-
@code {
51-
Telerik.Blazor.Components.DatePicker.TelerikDatePicker theDatePicker;
52-
}
53-
````
5437

5538
The Date Picker component exposes the following features:
5639

components/numerictextbox/overview.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,17 @@ The Numeric Textbox component allows the user to enter decimal values and no tex
1414

1515
To use a Telerik Numeric Textbox for Blazor, add the `TelerikNumericTextBox` tag.
1616

17-
>caption Basic numeric textbox with its key features, and ValueChanged event handling
18-
19-
@[template](/_contentTemplates/common/issues-and-warnings.md#generic-component-event-issue)
17+
>caption Basic numeric textbox with its key features
2018
2119
````CSHTML
2220
@using Telerik.Blazor.Components.NumericTextBox
2321
24-
<TelerikNumericTextBox Format="C" Max="5m" Min="-5m" Step="0.33m" Value="3.456m" ValueChanged="@MyValueChangeHandler"></TelerikNumericTextBox>
22+
<TelerikNumericTextBox Format="C" Max="5m" Min="-5m" Step="0.33m" @bind-Value="@theValue"></TelerikNumericTextBox>
2523
<br />
26-
The new value is: @result
24+
The new value is: @theValue
2725
2826
@code {
29-
private string result;
30-
31-
private void MyValueChangeHandler(object newValue)
32-
{
33-
//the event argument is an object you can cast to the type you are actually using
34-
result = newValue.ToString();
35-
}
27+
private decimal theValue { get; set; } = 1.234m;
3628
}
3729
````
3830

components/textbox/overview.md

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,24 @@ The Textbox component allows the user to enter a generic plain text message. The
1414

1515
To use a Telerik Textbox for Blazor, add the `TelerikTextBox` tag.
1616

17-
>caption Basic textbox with its key features, and ValueChanged event handling
17+
>caption Basic textbox with its key features, namespace and reference
1818
19-
@[template](/_contentTemplates/common/issues-and-warnings.md#generic-component-event-issue)
2019

2120
````CSHTML
2221
@using Telerik.Blazor.Components.TextBox
2322
24-
<TelerikTextBox ValueChanged="@MyValueChangeHandler" @bind-Value="theTbValue"
25-
Label="Enter Information" Id="myInputId" MaxLength="20"></TelerikTextBox>
23+
<TelerikTextBox @bind-Value="theTbValue" Label="Enter Information" MaxLength="20" @ref="theTextBoxRef"></TelerikTextBox>
2624
27-
@result
25+
@theTbValue
2826
2927
@code {
30-
string result;
31-
string theTbValue { get; set; } = "lorem ipsum";
28+
string theTbValue { get; set; } = "lorem ipsum";
3229
33-
private void MyValueChangeHandler(string theUserInput)
34-
{
35-
result = string.Format("The user entered: {0}", theUserInput);
36-
37-
StateHasChanged();
38-
}
39-
}
40-
````
41-
42-
>caption Component namespace and reference
43-
44-
````CSHTML
45-
@using Telerik.Blazor.Components.TextBox
46-
47-
<TelerikTextBox @ref="theTextBoxRef"></TelerikTextBox>
48-
49-
@code {
5030
Telerik.Blazor.Components.TextBox.TelerikTextBox theTextBoxRef;
5131
}
5232
````
5333

34+
5435
The numeric textbox provides the following features:
5536

5637
* `Class` - the CSS class that will be rendered on the `input` element.

0 commit comments

Comments
 (0)