User control in ASP.NET MVC.

Posted by  James Smith
 3977  View(s)
Ratings:
Rate this:
Hi....
Am very new in asp.net mvc. I want to create a user control in asp.net mvc. I had created it but I did not able to refrence it in my views.
Please help me!

Thanks.
  1. Re: User control in ASP.NET MVC.

    Hi James Smith,
    You can write down following code in view where you want to access user control.

    <div>
          <% Html.RenderPartial("UserControl1"); %>
    </div>

    Where UserControl1 is name of usercontrol which is created under View/Shared directory.

    Thanks.

      Modified On Mar-29-2018 04:26:16 AM
  1. Re: User control in ASP.NET MVC.

    Hi everyone in this article I’m explaining about Scaffolding with Asp.net mvc.

    https://www.mindstick.com/articles/1656/asp-dot-net-mvc-scaffolding

Answer