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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 44
    Comment on it

    When we want to use piece of code again and again and want to make it reusable throughout the application we will make it a partial view.

    Partial view is like user control in a normal web application that is created and placed anywhere in the page.

     

    You can create a controller and after that you can create an event and when you add a view for that event you can make it as a partial view.

     

     

    @model PartialViewSample.Models.Product
    
    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>AddProduct</title>    
    </head>
    <body>
        <div>      
               <label>Id:</label>
                @Html.TextBox("Id", Model.Id)
                 <label>Name:</label>
                @Html.TextBox("Name", Model.Id)
                 <label>Description:</label>
                @Html.TextBox("Description", Model.Description)
                 <label>Quantity:</label>
                @Html.TextBox("Quantity", Model.Quantity)
        </div>
    </body>
    </html>

     

    After creating this you can create any event and associate with this view for reusing it.

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