I am trying to implement a MVC Razor _Layout.cshtml page that uses a WebForm ascx User Control (non-MVC). I am doing this based off the \"Yes\" section of this Scott Hansleman a
you can use asp.net user control in MVC by the following way
1st change user control inheritance this as by default
default:
public partial class TestControl: UserControl
{
// ...
}
change:
public partial class TestControl: ViewUserControl
{
// ...
}`
2nd user control with asp.net controls like this one within form tag and script manager should be call
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestControl.ascx.cs" Inherits="TestApp.UserControls.TestControl" %>
Welcome Test User Control
3rd Call user control in MVC View as
@{ Html.RenderPartial("~/UserControls/TestControl.ascx"); }
it should work without any issue, and it will be beneficial to convert old asp.net website into MVC, if old website have user controls, its so easy to upgrade with new technology in MVC.