Copied to clipboard

Flag this post as spam?

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


  • David Zweben 266 posts 750 karma points
    Jul 21, 2018 @ 14:56
    David Zweben
    0

    Best way to pre-populate a surface controller with member data?

    I am making a page for members on the site to update their membership information. I have this set up as a partial view that is displaying a custom model and posting to a custom surface controller action to update the data.

    I want the partial view to pre-populate with the member's current data. I can think of a couple ways to do this, but I'm not sure what the best way is. Can anyone point me in the right direction?

    Thanks,
    David

  • David Armitage 505 posts 2073 karma points
    Jul 22, 2018 @ 04:50
    David Armitage
    0

    Hi David,

    Sorry I am not sure I fully understand your questions. What are you trying to achieve?

    Are you just looking for code to get a list of members using the API and then assign these to the model and push them to the partial view?

    Kind Regards

    David

  • David Zweben 266 posts 750 karma points
    Jul 22, 2018 @ 17:51
    David Zweben
    0

    Hi David,

    Thanks for your response. What I am trying to do is pre-populate the form fields on a "update profile" page for logged-in members, with the member's current data. For example, for the "update company name" field, I want it to be pre-filled with the user's currently saved company name.

    I'm currently achieving this via code inside the BeginUmbracoForm block on the partial view, that sets the form's model's values to the user's current values if they are present. I feel like this isn't the cleanest way to do this, though, so if anyone could suggest a nicer way, I'd appreciate it.

    Thanks,
    David

Please Sign in or register to post replies

Write your reply to:

Draft