views:

219

answers:

2

Hello, I am using this tutorial to create an application in ASP.NET MVC 2 where I can register users with custom profile properties using the CreateUserWizard control.

My problem is that the tutorial uses ASP.NET (not MVC) and it needs the code-behind of the control for handling the CreateUserWizard1_CreatedUser method.

Since in ASP.NET MVC Views don't have a code-behind by default, I would like to know how can I have access to that method.

Thanks in advance, Sam.

A: 

It looks like the CreateUserWizard is a standard ASP.Net control, and therefor is not going to work in MVC. You can reference standard ASP.Net controls from MVC views, but any functionality they have that relies on ViewState or PostBack is not going to work, since neither of those concepts exist in MVC.

That being said, it is possible to run ASP.Net WebForms and ASP.Net MVC within the same application, so if you wanted to create this functionality using webforms, you could do that, and simply link to the webforms page to do your user creation.

Have a look at this blog post from Scott Hanselman talking about running ASP.Net MVC, WebForms, and ASP.Net Dynamic Data in the same application.

ckramer
A: 

You could also create a wizard-like ASP.NET MVC pattern, as described here:

http://www.highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx http://www.highoncoding.com/Articles/647_Creating_Wizard_Using_ASP_NET_MVC_Part_1.aspx

With MVC2, however, you will have a problem with partial model validation. It can be solved by using a separate ViewModel for every page, or by using ActionFilters as described here:

http://blog.stevensanderson.com/2010/02/19/partial-validation-in-aspnet-mvc-2/

Yakimych