asp.net mvc - Setting a razor variable to the value of a dropdown -
i have form inside of modal takes in list of total ec2 instances. trying adjust second drop down value of first 1 second drop down sees instances relative volumes.
<form action="/s3/attachvolume/" method="post"> <div class="form-group"> <p>please double check ids of instance , volume</p> <label for="instanceid">instanceid:</label> <select class="form-control text-center" name="instanceid" id="instances" style="margin: 0 auto"> @for (var = 0; <= totalcount - 1; i++) { foreach (var instances in model.instances.reservations[i].instances) { <option>@instances.instanceid</option> } } </select> <label for="type">volume id:</label> <select class="form-control text-center" name="volumeid" id="volumeid" style="margin: 0 auto"> @foreach (var volume in @*aboveinstance*@.blockdevicemappings) { <option>@volume.devicename</option> } </select> </div> <div class="modal-footer"> <button type="submit" class="btn btn-danger btn-lg" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span> detach</button> </div> </form>
is possible store value of instanceid<select>
inside of variable similar var can loopthrough in second select?
for reference var instance
contains following data
sorry if obvious new .net , razor , hard find resources when working aws sdk
razor renders view on server side , doesn't know client-side change user can make.
any occurs after page loaded, such select change, must handled though javascript, better if using framework angularjs make life easier.
your javascript function call service every time select value changes data it's needed re-populate other control.
Comments
Post a Comment