Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Modalpopup in MVC

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 35
    Comment on it

    While working with MVC project there are scenarios where you stuck and want model popup for the solution.

     

    In MVC applying model popup is the same as we do it in the legacy models or framework.

     

    So we will use JQuery for applying the popup wherever we want to show.

     

     <!-- Modal -->
        <div class="modal fade" id="employeeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">Player</h4>
                    </div>
                    <div class="modal-body">
                        <form>
                            <input type="hidden" id="EmpId" />
                            <div class="form-group">
                                <label for="name">First Name</label>
                                <input type="text" class="form-control" id="txtFirstName" placeholder="Enter Name">
                            </div>
                            <div class="form-group">
                                <label for="placeOfBirth">Middle Name</label>
                                <input type="text" class="form-control" id="txtMiddleName" placeholder="Enter Middle Name">
                            </div>
                            <div class="form-group">
                                <label for="dateOfBirth">Last Name</label>
                                <input type="text" class="form-control" id="txtLastName" placeholder="Enter Last Name">
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" id="btnSave" class="btn btn-primary">Save</button>
                    </div>
                </div>
            </div>
        </div>

     

    This is the popup which we have made and about to use in our project.

     

        <link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css">
        <link href="~/Content/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
        <link href="~/Content/grid-0.4.3.min.css" rel="stylesheet" type="text/css">

     

    Then the last thing is to invoke it from wherever you want.

     

     function Add() {
            $("#playerId").val("");
            $("#name").val("");
            $("#txtMiddleName").val("");
            $("#txtLastName").val("");
            $("#employeeModal").modal("show");       
        }

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: