The project I am working on was a project that was originally WebForms and later migrated to Asp.Net MVC. 3 pages are still using Webforms and it's not worth the effort to rewrite them.
To prevent having to maintain two separate master pages that look identical I have two master pages, MVC.Master
and Webforms.Master
. Webforms.Master
has MVC.Master
set as its master page, so that whenever I add a new tool link to my menu it always shows no matter if the user is looking at a Webforms or MVC page. The Webforms.Master
has nothing but an ajaxToolkit Script manager on it.
Everything has been working fine until now, where I am adding Telerik support. The problem is that you cannot use Html helpers in WebForm pages, as you get the exception A ViewMasterPage can be used only with content pages that derive from ViewPage or ViewPage<TModel>.
Since I do not care if Telerik's script and stylesheet registrars are run for Webform pages, I ideally would like to do something like
<% if (!PageIsWebforms)
{
Html.Telerik().....
}
%>
Unfortunately, I can't think of a good way to successfully determine if the inner page is a WebForms page or not. Does anyone have any ideas how I can accomplish this?
MVC pages inherit something other than System.Web.UI.Page, could you test Page is System.Web.MVC.ViewPage
. You could make that a property to make the markup easier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.