dimanche 17 avril 2016

Drop Downs not passing data to controller

I have set up a modal with a form to pass data into my controller like so.

<div class="container">
<div class="modal fade" id="modalcreate" tabindex="-1" role="dialog" aria-labelledby="createGroup" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
                <h4 class="modal-title text-center">Create a New Instance</h4>
            </div>

            <div class="modal-body" style="text-align: center">
                <div class="row">
                    <div class="modal-body" style="text-align: center">
                        <form action="/Home/CreateInstance/" method="POST">
                            <div class="form-group">
                                <label for="amiId">AMI ID:</label>
                                <select class="form-control text-center" id="amiId" style="margin: 0 auto">
                                    <option>ami-8519a9f6</option>
                                    <option>ami-8b8c57f8</option>
                                </select>
                                <label for="keyPairName">Key Pair Name:</label>
                                <input name="keyPairName" class="form-control text-center" type="text" placeholder="Conners Key" style="margin: 0 auto">
                                <label for="instanceType">InstanceType:</label>
                                <select class="form-control text-center" id="instanceType" style="margin: 0 auto">
                                    <option>InstanceType.T1Micro</option>
                                </select>
                                <label for="minCount">Minimum Instance Number:</label>
                                <input name="minCount" class="form-control text-center" type="text" placeholder="1" style="margin: 0 auto">
                                <label for="maxCount">Maximum Instance Number:</label>
                                <input name="maxCount" class="form-control text-center" type="text" placeholder="1" style="margin: 0 auto">
                                <label for="groups">Security Groups Attached:</label>
                                <select class="form-control text-center" id="groups" style="margin: 0 auto">
                                    @foreach (var groups in Model.groups)
                                    {
                                    <option>@groups.GroupName</option>
                                    }
                                </select>            
                            </div>
                            <div class="modal-footer">
                                <button type="submit" class="btn btn-success btn-lg" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span> Create</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

but for some reason, the method in the controller is only receiving the textbox data. According to W3 bootstrap inputs I have set them up correctly http://ift.tt/1jCqRj9

Can someone please tell me what I seem to be missing?

Aucun commentaire:

Enregistrer un commentaire