Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Hodgkinson 613 posts 355 karma points
    Mar 06, 2014 @ 22:51
    John Hodgkinson
    0

    what is the best way to set this up in MVC?

    I want to setup a membership search form.

    initial page load = user inputs search criteria (name, address, state, country, etc), clicks submit

    on form submission/post = fields retain user submitted form values plus binds data to grid... user can do sorting, paging, etc in grid retains user submitted form values

    is it best to have all the form input and results defined in the model... in the controller on the submit action, store that results and form data in viewdata/tempdata and then return RedirectToCurrentUmbracoPage, repopulate the form and if results exist then bind and display them in the grid?

    many thanks in advance!

     

     

     

  • Charles Afford 1163 posts 1709 karma points
    Mar 11, 2014 @ 20:28
    Charles Afford
    0

    Hi what version of Umbraco and are you using razor?

  • Charles Afford 1163 posts 1709 karma points
    Mar 11, 2014 @ 20:35
    Charles Afford
    0

    What you really need is a View say called Form

    In Form call a partial called formContent

    in form content you want to pass in a data model with some properties such as

    public string firstName {get;set;}

    public string lastName{get;set;}

    In the partial use either Html.BeginForm{} or Ajax,BeginForm to post to a surface controller

    and then return the result.

    Hope this makes sense.  Let me know if it does not and i will help some more :).  Charlie.

    This could help :) 

    http://www.charlesafford.com/setting-up-and-using-your-first-surface-controller.aspx

  • John Hodgkinson 613 posts 355 karma points
    Mar 11, 2014 @ 20:42
    John Hodgkinson
    0

    thx Charles that's similiar to the route I end up taking...

     

  • Charles Afford 1163 posts 1709 karma points
    Mar 11, 2014 @ 20:46
    Charles Afford
    0

    No worries John, sorry for the late reply.  

    If you could vote for me 

    http://our.umbraco.org/people/mvps

    That would be great ;)

Please Sign in or register to post replies

Write your reply to:

Draft