Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created one ascx page.how to get that page my Mvc View
Posted
Comments
Sunasara Imdadhusen 7-Oct-11 10:01am    
Do you want to add usercontrol in page?

1 solution

In ASP.NET we used to have ascx pages quite a lot. In MVC framework it is called as Partial View. You can render the Partial View on any page using the HTML tags.

Option 1:
HTML
<![CDATA[<% Html.RenderPartial("~/Views/Shared/YourUserControl.ascx", {data model object}) %>]]>


Option 2:
HTML
<![CDATA[<%= Html.RenderUserControl("~/Views/Shared/YourUserControl.ascx", {data model object}) %>]]>


For more information you can refer to http://jeffreypalermo.com/blog/asp-net-mvc-and-the-templated-partial-view-death-to-ascx/[^]

Hope this helps.
All the best.
 
Share this answer
 
Comments
Uday P.Singh 7-Oct-11 15:09pm    
my 5!
Pravin Patil, Mumbai 7-Oct-11 15:10pm    
Thanks Uday.....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900