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,