MVC WEBFORM INTEGRATION

Discussion in 'ASP .Net' started by Zesus, Sep 14, 2009.

  1. Zesus

    Zesus Guest

    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.
     
    Zesus, Sep 14, 2009
    #1
    1. Advertising

  2. Zesus <> wrote in news:cbd2ecd9-fb62-44e0-a427-
    :

    > 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,


    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    My vacation and childhood cancer awareness site:
    http://www.crazycancertour.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Sep 15, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rmn190
    Replies:
    2
    Views:
    2,366
    Arne Vajhøj
    Jan 10, 2008
  2. Paulo
    Replies:
    3
    Views:
    480
    Peter Bromberg [C# MVP]
    Dec 4, 2008
  3. Guoqi Zheng

    running webform page inside MVC framework

    Guoqi Zheng, Jun 7, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    1,011
    Joern Schou-Rode
    Jun 9, 2009
  4. Crazy Cat
    Replies:
    1
    Views:
    688
    schepp
    Sep 3, 2009
  5. Allan2010
    Replies:
    3
    Views:
    1,862
    Cubaman
    May 6, 2010
Loading...

Share This Page