Hi,
I guess this is a feature request! It would be good if I could set the bind-value to a property of the same type as the type of the IEnumerable used to populate the list.
At the moment I'm not sure if this is possible as it seems to insist on a Value Field, but I don't want to bind to a field I want to bind to the whole class. So instead of this:
<TelerikDropDownList Data=
"@NavSets"
TItem=
"UiNavSet"
TValue=
"Guid"
Width=
"200px"
TextField=
"DisplayName"
ValueField=
"Id"
@bind-Value=
"@CurrentNavSetId"
PopupHeight=
"100"
/>
@{
[Parameter]
public
List<UiNavSet> NavSets {
get
;
set
; }
private
Guid _currentNavSetId;
Guid CurrentNavSetId
{
get
=> _currentNavSetId;
set
{
if
(_currentNavSetId != value)
{
_currentNavSetId = value;
ChangeNavSet(_currentNavSetId);
}
}
}
}
I want to do this:
<TelerikDropDownList Data=
"@NavSets"
TItem=
"UiNavSet"
TValue=
"UiNavSet"
Width=
"200px"
TextField=
"DisplayName"
ValueField=
"?????"
@bind-Value=
"@CurrentNavSet"
PopupHeight=
"100"
/>
@{
[Parameter]
public
List<UiNavSet> NavSets {
get
;
set
; }
public
UiNavSet CurrentNavSet {
get
;
set
; }
// Bind to this
}
I'm not sure if this achievable, or what to put in ValueField??
Thanks.