MVC WEBFORM INTEGRATION

Z

Zesus

I have an MVC website and some webform pages what I would like to do
is when a button is clicked on a webform page, in the onclick event of
the button, call the MVC controller action that will launch the mvc
page in the same browser window. What is the best way to implement
this.

Thanks in advance.
 
G

Gregory A. Beamer

I have an MVC website and some webform pages what I would like to do
is when a button is clicked on a webform page, in the onclick event of
the button, call the MVC controller action that will launch the mvc
page in the same browser window. What is the best way to implement
this.


You really don't want to do what you think you want to do, as you are
making things very difficult on yourself trying to mix systems. ASPX and
MVC working together is designed more for those who are migrating. you
are best to have functionality moved to libs and then call hte libs from
either an ASPX or an MVC page.

One potential exception would be to show a particular item on an MVC
page from form submit on an ASPX, although I am still not convinced this
is a proper way to do things.

To do this, you handle the form submit and the forward the request to
the MVC with the proper argument(s). The controller will naturally take
over, as the route is set up for MVC.

You can have an ASPX list that has MVC links rather easily, as well. you
wimply format the links properly for the hyperlinks using a filter on
the GridView (as an example).

Submitting a form to an MVC page, however, is a time consuming operation
that does not buy you much.

If you are migrating from ASPX to MVC, do it one bit of functionality at
a time (one page at a time, if your app is set up that way). You will
find this provides fewer headaches.

Now, you may have discovered a beautiful blending of ASP.NET and MVC. If
so, post more of what you are trying to accomplish (from a business
standpoint, not a technical standpoint) and we can examine it further.

Peace and Grace,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top