|
@using SyncfusionASPNETCoreApplication1.Controllers;
<div id="modal-container" class="modal fade hidden-print" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
<script>
$('#modal-container').on('show.bs.modal', function (event) {
//button that raised the event
var button = $(event.relatedTarget);
//url attached to button clicked.
var url = button.attr("rel='nofollow' href");
//the modal
var modal = $(this);
// note that this will replace the content of modal-content ever time the modal is opened
modal.find('.modal-content').load(url);
});
$('#modal-container').on('hidden.bs.modal', function () {
// remove the bs.modal data attribute from it
$(this).removeData('bs.modal');
// and empty the modal-content element
$('#modal-container .modal-content').empty();
});
</script>
<a class="btn btn-primary" data-target="#modal-container" data-toggle="modal" asp-action="Create">New <span class="fa fa-plus"></span></a>
<div class="modal-body">
<form asp-action="Create" method="post" id="NewAirline" asp-antiforgery="true">
<div class="form-horizontal">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label class="col-md-2 control-label">Airline</label>
<div class="col-md-10">
<input class="form-control" />
<span class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Type</label>
<div class="col-md-10">
@* DOES NOT RENDER*@
<ej-drop-down-list id="Type" datasource="@(IEnumerable<AirlineType>)ViewBag.AirlineTypes">
<e-drop-down-list-fields text="TypeName" value="AirlineTypeId" />
</ej-drop-down-list>
<span class="text-danger"></span>
</div>
</div>
</div>
</form>
</div>
|
|
public ActionResult Create()
{
Airline.Add(new AirlineType { TypeName = "American Airlines", AirlineTypeId = "AL1" });
Airline.Add(new AirlineType { TypeName = "United Airlines", AirlineTypeId = "AL2" });
Airline.Add(new AirlineType { TypeName = "NorthWest Airlines", AirlineTypeId = "AL3" });
ViewBag.AirlineTypes = Airline;
return View("DropdownlistFeatures");
} |