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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 52
    Comment on it

    Partial View in MVC is used when we want to use section for the master or the main page again and again.

     

    It is just like a user control that is used to display or get data in the view that we want.

     

    So as a beginner, you first need to create the MVC project .

     

    After doing that you need to create a view for the index action

     

     

     

    After doing this we will create a partial view named _EmployeePartial

     

     public ActionResult _EmployeePartial()
            {
                Partial_View.Models.EmployeeModel obj = new Models.EmployeeModel();
                obj.FirstName = "Himanshu";
                obj.MiddleName = "Chandra";
                obj.LastName = "Joshi";
                return PartialView(obj);
            }

     

    Then we will create the partial view for this action.

     

     

     

    After doing this we will render the partial view into our index view

     

    <div class="jumbotron">
        <h1>ASP.NET</h1>
        <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
        <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
    </div>
    
    <div class="row">
        <div class="col-md-4">
            <h2>Getting started</h2>
            <p>
                ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
                enables a clean separation of concerns and gives you full control over markup
                for enjoyable, agile development.
            </p>
            <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
        </div>
    
    
        @{Html.RenderAction("_EmployeePartial", "Home");}

     

    .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: