Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use ASP.NET Web Forms UserControl in ASP.NET MVC?

Tags:

asp.net-mvc

I've been tasked with making a prototype web application, and i'm debating between using ASP.NET WebForms or the new ASP.NET MVC.

There is a commerical ASP.NET UserControl that i would like to use that gives me 95% of the functionality i need (and it does it in an AJAX-y fashion). But i've heard that since ASP.NET MVC doesn't use ViewState, it can't run these WebForms-based controls.

So, is that true or false?

I'd really like to use this commerical UserControl, but i want to use ASP.NET MVC if i can, and only if ASP.NET MVC is not going to give me much trouble when trying to use the WebForms-based control.

like image 979
Matt Crouch Avatar asked Jan 19 '09 20:01

Matt Crouch


1 Answers

Traditional WebForms and MVC aren't mutually exclusive; you could run both of them in the same site. For an explanation of how to make this happen, see this post by Scott Hanselman.

So you could, for example, create WebForms-based page(s) to leverage the commercial control, and use MVC for everything else. You could also set up a simple test to see if the control can operate without ViewState -- making it OK to use in MVC -- and fall back on the hybrid approach.

like image 135
Jeffrey Meyer Avatar answered Nov 14 '22 23:11

Jeffrey Meyer