开发者

how to render Partial with inheritence in MVC 3?

开发者 https://www.devze.com 2023-02-20 07:18 出处:网络
I have this function in my MVC project ViewPage vp = new ViewPage(); System.Web.UI.Control control = vp.LoadControl(controlName);

I have this function in my MVC project

  ViewPage vp = new ViewPage();
          System.Web.UI.Control control = vp.LoadControl(controlName);
开发者_JS百科

if i render a partial control using this function then they render only ASPX based partial control they never render Razor partial control because they are inherited by System.Web.Mvc.WebViewPage

so how i can render the partial view in MVC that can render both type of partial or just render razor partial.


You are correct, I don't believe you can use ASP.NET controls with the Razor engine this way. If you want to ASP.NET controls, I would use the ASP.NET engine for your MVC application instead of Razor.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号