I appreciate if someone instruct or give me a helpful link in how this 2 technologies work together side by side. In routeing where I get the most difficulties, when I give link a MVC page to Web Form with Web.sitemap datasource it works fine in some cases but except those runat server tags error.
-
1blogs.imeta.co.uk/MGodfrey/archive/2009/03/31/663.aspx and packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvcTim Schmelter– Tim Schmelter2011-07-30 16:18:50 +00:00Commented Jul 30, 2011 at 16:18
-
1You could be (a lot) clearer about what you tried, and what errors that produced. Code is gong to be clearer than English here.Henk Holterman– Henk Holterman2011-07-30 16:19:30 +00:00Commented Jul 30, 2011 at 16:19
-
Thank you Henk for your comment. The error I am getting is "Control 'MainContent_lv1_Login1' of type 'Login' must be placed inside a form tag with runat=server" in most places where there is runat=server code when I copy and paste the web forms code to a MVC page.Akbar Admg– Akbar Admg2011-07-30 16:44:51 +00:00Commented Jul 30, 2011 at 16:44
2 Answers
It doesn't seem to me like you are trying to run webforms side-by-side with MVC. It seems like you want to use Webforms code in an MVC page, which is something very different.
side-by-side means you might have one page that is webforms, and another page that is MVC in the same site. That is doable.
Making Webforms code work in an MVC page is far more tricky, and in most cases won't work. While it's true that you can use the webforms view engine, and even have a code behind with an MVC page, you will find that much of the Webforms infrastructure isn't there. You can't use Viewstate, and most controls rely on viewstate. So you can only use controls that do not rely on Viewstate (there aren't a lot of those kinds of controls).
I think you need to be more clear about what you are trying to do.
4 Comments
From my own experience this is a bad idea. On my team, we are currently in the middle of a migration for a product built in Webforms to MVC, so there are places where we have to deal with this temporarily tell we can successfully rewrite all the Webforms functionality. However, the information in this blog post will be helpful for you, there is a sample project as well.