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 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.
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
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
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
is working on a reply...