We currently have a vb web form application and we are wanting to migrate this to C# MVC. Rather than doing a full rewrite we are wanting to move a project at a time.
I know its possible to have a hybrid project with webforms and mvc as detailed below:
http://blog.falafel.com/integrating-aspnet-mvc-4-into-existing-web-forms-applications/
But the problem I have is if the outer pages of the web application remain vb/asp.net web forms and when a user clicks on an area ie a button that has been rewritten in c#/razor mvc how do I load / direct the user and render the razor views within web forms.
Can I render a razor view within webforms?
If not can I direct to a new tab?
Any ideas how to do this ?
Thanks
I currently working on the same hubryd project where i have WebForm Part and MVC part.
We try to get rid off WebForms part.
The strategy that i come out with is:
OnClientClick='<%# "showEntityList("+Eval("Id")+"); return false;" %>'
js code that make ajax call (i use jquery dialog behind this function):
function showEntityList(Id) {
dialogSaveCancel(
{
title: "Entity List",
urlPost: '/ControllerName/ControllerMethodName?id=' + Id,
callback:
{
success: function (data, textStatus, jqXHR) {
var url = 'test';
window.location.replace(url);
},
error: function () { }
}
});
};
So you can get your Razor View in WebForms part.
If you want a new Tab you also can use js:
function ShowInNewTab(path) {
window.open(SiteAppRootPath + path, '_blank');
}
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.