Skip to content

Commit 4495eee

Browse files
svdimitrjivanova
authored andcommitted
docs(mc-combo): custom values article
1 parent 9668345 commit 4495eee

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

components/multicolumncombobox/custom-value.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
---
22
title: Custom Value
3-
page_title: ComboBox - Custom Value
4-
description: Custom values and user input in the ComboBox for Blazor.
5-
slug: components/combobox/custom-value
6-
tags: telerik,blazor,combo,combobox,custom,value,input
3+
page_title: MultiColumnComboBox - Custom Value
4+
description: Custom values and user input in the MultiColumnComboBox for Blazor.
5+
slug: multicolumncombobox-custom-value
6+
tags: telerik,blazor,multicolumncombobox,combobox,custom,value,input
77
published: True
88
position: 20
99
---
1010

11-
# ComboBox Custom Values
11+
# MultiColumnComboBox Custom Values
1212

13-
The ComboBox component allows the user to type in their own value that is not a part of the predefined set of options that the developer provided.
13+
The MultiColumnComboBox component allows the user to type in their own value that is not a part of the predefined set of options that the developer provided.
1414

1515
The text entered by the user can still go into the field the combo box is bound to through two-way binding.
1616

1717
To enable custom user input set the `AllowCustom` parameter to `true`.
1818

1919
>note When custom values are enabled, the `TextField`, `ValueField` and the `Value` must be of type `string`. Otherwise an exception will be thrown. Strings are required because the user input can take any form and may not be parsable to other types (such as numbers or GUID).
2020
21-
When custom input is allowed, the [ValueChanged event]({%slug components/combobox/events%}) fires on every keystroke, and not when an item is selected, because the ComboBox component acts as a text input.
21+
When custom input is allowed, the [ValueChanged event]({%slug multicolumncombobox-events%}) fires on every keystroke, and not when an item is selected, because the ComboBox component acts as a text input.
2222

23-
When custom values are typed in, there may be no selected item in the ComboBox. See the [ComboBox Overview - Selected Item]({%slug components/combobox/overview%}#selected-item) article for details on when how item selection and `Value` work together.
23+
When custom values are typed in, there may be no selected item in the ComboBox. See the [ComboBox Overview - Selected Item]({%slug multicolumncombobox-overview%}#selected-item) article for details on when how item selection and `Value` work together.
2424

2525
>caption Allow custom user input in the combo box
2626
2727
````CSHTML
2828
Selected value: @selectedValue
2929
<br />
3030
31-
<TelerikComboBox Data="@myComboData" TextField="MyTextField" ValueField="MyValueField" @bind-Value="selectedValue"
31+
<TelerikMultiColumnComboBox Data="@myComboData" TextField="MyTextField" ValueField="MyValueField" @bind-Value="selectedValue"
3232
AllowCustom="true"
3333
Placeholder="select an item or type your own">
34-
</TelerikComboBox>
34+
<MultiColumnComboBoxColumns>
35+
<MultiColumnComboBoxColumn Field="@nameof(MyDdlModel.MyValueField)" Title="Unique Identifier"></MultiColumnComboBoxColumn>
36+
<MultiColumnComboBoxColumn Field="@nameof(MyDdlModel.MyTextField)" Title="Human-readable text"></MultiColumnComboBoxColumn>
37+
</MultiColumnComboBoxColumns>
38+
</TelerikMultiColumnComboBox>
3539
3640
@code {
3741
IEnumerable<MyDdlModel> myComboData = Enumerable.Range(1, 20).Select(x => new MyDdlModel { MyTextField = "item " + x, MyValueField = x.ToString() });
@@ -53,11 +57,15 @@ Selected value: @selectedValue
5357
5458
@ComboValue
5559
<br />
56-
<TelerikComboBox Data="@Data" @bind-Value="@ComboValue"
60+
<TelerikMultiColumnComboBox Data="@Data" @bind-Value="@ComboValue"
5761
OnChange="@((object value) => AddItem(value))"
5862
TextField="ProductName" ValueField="ProductName"
5963
AllowCustom="true" Filterable="true" Placeholder="SELECT A PRODUCT">
60-
</TelerikComboBox>
64+
<MultiColumnComboBoxColumns>
65+
<MultiColumnComboBoxColumn Field="@nameof(Product.ProductId)"></MultiColumnComboBoxColumn>
66+
<MultiColumnComboBoxColumn Field="@nameof(Product.ProductName)"></MultiColumnComboBoxColumn>
67+
</MultiColumnComboBoxColumns>
68+
</TelerikMultiColumnComboBox>
6169
6270
@code {
6371
public List<Product> Data { get; set; }
@@ -105,6 +113,6 @@ Selected value: @selectedValue
105113

106114
## See Also
107115

108-
* [Live Demo: ComboBox Custom Values](https://demos.telerik.com/blazor-ui/combobox/custom-values)
116+
* [Live Demo: ComboBox Custom Values](https://demos.telerik.com/blazor-ui/multicolumncombobox/custom-values)
109117

110118

0 commit comments

Comments
 (0)