'DevExpress Pass two keys to LookupFor DataSource request on LoadUrl
I Have two column for key in table but I cant find any way to pass them both...
This is my element
<div class="form-inline">
@Html.LabelFor(m => m.StreetCode)
<div class="form-inline formGroup">
@(Html.DevExtreme().LookupFor(m => m.StreetCode).ID("StreetCodeId")
.DataSource(d => d.RemoteController()
.LoadUrl("/look/Streets")
.Key("CodeStreet"))
.ValueExpr("CodeStreet")
.DisplayExpr("Street")
.Width("100%")
.Value(Model.StreetCode))
<span asp-validation-for="StreetCode" class="text-danger"></span>
</div>
</div>
this is my method
public IActionResult Streets(DataSourceLoadOptions loadOptions)
{
return Json(DataSourceLoader.Load(DB.Table, loadOptions));
}
I get the right key for street
When I try to pass two keys I got
like .Key("CodeStreet","CityCode"))
for example
<div class="form-inline">
@Html.LabelFor(m => m.StreetCode)
<div class="form-inline formGroup">
@(Html.DevExtreme().LookupFor(m => m.StreetCode).ID("StreetCodeId")
.DataSource(d => d.RemoteController()
.LoadUrl("/look/Streets")
.Key("CodeStreet","CityCode"))
.ValueExpr("CodeStreet")
.DisplayExpr("Street")
.Width("100%")
.Value(Model.StreetCode))
<span asp-validation-for="StreetCode" class="text-danger"></span>
</div>
</div>
I got
this :
How do I fix the problem?
Solution 1:[1]
DevExpress does not support composite keys to my knowledge. Take a look at this thread.
You can also override the onLoad
and pass the keys through a URL parameter.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Filipe Nóbrega |