ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Odropdown add parameter in input model class
Title:
B
I
{code}
?
Hi, I need to filter a dropdown list in a controller; I tried to add a [AwesomeParents("{evoId: 'EvoId'}")] but it is null. my view Create button: <div class="bar"> <button type="button" onclick="awe.open('createMmaGrid')" class="awe-btn mbtn"><span localize>Create</span></button> </div> my input model: public class MmaInput : Base.Input { #region Properties [UIHint("Hidden")] public Guid? EvoId { get; set; } [Required(ErrorMessageResourceName = "required", ErrorMessageResourceType = typeof(DataAnnotations))] [Display(Name = "EventOffice", ResourceType = typeof(DataAnnotations))] [UIHint("Odropdown")] [AwesomeParents("{evoId: 'EvoId'}")] [AweUrl(Controller = "EventOffice", Action = "GetEventOfficeListFilteredLookup")] public Guid IdEvoMma { get; set; } ... } in my lookup controller, I added a method: public IActionResult GetEventOfficeListFilteredLookup(Guid? evoId) { var items = _evoService.GetAll().Where(x=> x.IdEvo == evoId) .ToList(); var keyContent = items.Select(x => x.ToKeyContent(x, $"{x.IdEveEvoNavigation.EventName} -> {x.IdOffEvoNavigation.OfficeName}")).ToList(); return Json(keyContent); } In runtime, I check the value in the controller's Create and I can see EvoId with a good Guid value. In the loopup controller, the GetEventOfficeListFilteredLookup evoId param is always null. Can you please help me to fix this ? Thanks -Vince
Save Changes
Cancel
vRITHNER
asked at 14 Sep 2017
Answers
B
I
{code}
?
if you're on using ASP.net Core make sure you registered the `AweMetaProvider` in `Startup.cs` var provider = new AweMetaProvider(); services.AddMvc(o => { o.ModelMetadataDetailsProviders.Add(provider); })
Save Changes
Cancel
Omu
answered at 14 Sep 2017
I already have it in startup.cs
at 14 Sep 2017
vRITHNER
try creating an EditorTemplate just for this field, add the .Parent(evo... and use it using UiHint
at 14 Sep 2017
Omu
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK