开发者

Use an MVC Master Page in a WebForm page

I have an MVC application that I am creating that I have to integrate regular WebForms into the site. T开发者_如何学运维he WebForm pages will be using a ReportViewer control so I believe that won't work in a regular MVC view because ReportViewer uses ViewState, etc.

Is it possible for me to create a regular Web Form that uses an MVC View Master page? If so...is it possible to use the Html helper methods such as RenderPartial?


Is it possible for me to create a regular Web Form that uses an MVC View Master page?

I don't know for sure, but it might work, as long as it's just markup and doesn't use any MVC-specific features.

If so...is it possible to use the Html helper methods such as RenderPartial?

Nope. If you use it this way, the Html property will not be set automatically, and I don't know of any way to hack it in.

We began a project in WebForms and realized partway through that MVC suits our purposes far better, so until we can finish migrating away from WebForms we have to maintain two separate versions of each of our "portal" elements (tabs, logout buttons, etc.). It's a pain, but it's doable.


Instead of using RenderPartial you could call a MVC controller with ajax from your webforms app and use the html it returns.

  if (Request.IsAjaxRequest())
   return View("someascx", model);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜