I am attempting to set up a drop down in my App that allows users to select a list of metadata depending upon whether or not it is classified as PII. The problem I am running into is how to essentially incorporate the logic behind @Ajax.ActionLink() into my option results and execute them without navigating to the partialview (as I want it to be displayed within the current page).
View Page:
<div class="col-md-4">
<select class="form-control" onchange="location.href = this.value">
<option value="">Select a PII Designation List</option>
<option data-ajax="true" data-ajax-begin="ClearMetadataResults" data-ajax-loading="#divMetadataLoading" data-ajax-method="GET" data-ajax-mode="replace" data-ajax-update="#divMetadata" value='@("/Applications/Metadata?applicationName=" + Model.ApplicationName + "&isPii=" + true)'>Yes</option>
<option data-ajax="true" data-ajax-begin="ClearMetadataResults" data-ajax-loading="#divMetadataLoading" data-ajax-method="GET" data-ajax-mode="replace" data-ajax-update="#divMetadata" value='@("/Applications/Metadata?applicationName=" + Model.ApplicationName + "&isPii=" + false)'>No</option>
</select>
</div>
I would greatly appreciate any feedback.
After Andy Stagg's comment, I decided to instead set up an Ajax.BeginForm() that would be triggered by a selection of an option, which ended up working for me.
Here is the resultant code:
And here:
Ideally, I would have liked to find out how to set up my own Ajax.DropdownList() helper so as to achieve something similar to my initial setup. If anyone happens to figure out how to do this, please comment or answer!