bootstrap modal in MVC

Bootstrap modal dialog in MVC
Add the following code to your view.cshtml change the content inside  <div class="modal-body"> </div> 

<div class="row">
    <div class="col-lg-12">
        <button type="button" class="btn btn-info" data-toggle="modal" data-target="#mymodal">Open Modal</button>
    </div>
</div>

<div class="modal fade" id="mymodal" tabindex="-1" role="basic" 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"></button>
                <h4 class="modal-title">Login Info</h4>
            </div>
            <div class="modal-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="control-label col-md-3">Name</label>
                        <div class="col-md-8">
                            <input type="text" id="txtname" name="txtname" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">Father Name</label>
                        <div class="col-md-8">
                            <input type="text" id="txtFartherName" name="txtFartherName" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">Address</label>
                        <div class="col-md-8">
                            <input type="text" id="txtAddress" name="txtAddress" class="form-control" />
                        </div>
                    </div>

                   
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                <button type="button" onclick="SaveData(ref);"  class="btn btn-primary">Save</button>
            </div>
        </div>
    </div>
</div>

by clicking the (open modal) button you will see the following result.



Post a Comment