USER CONTROL IN ASP.NET MVC.

James Smith

Total Post:48

Points:336
Posted by  James Smith
 2053  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. Awadhendra Tiwari

    Post:126

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!