Developer forum

Forum » Templates » Display custom fields on users / dealers

Display custom fields on users / dealers

Pål Messenlien
Reply

Hi
I'm working on a project for a customer who need's Custom fields to display on the standard swift find dealer. I'm struggling to output any information from custom fields on the users.
The code i have been playing around with are:

  @foreach (var location in locationList) {
                @(location.AccessUser_Webpage) //this is the custom field on the user
            }

The code give me a me a UserViewmodel error. What should i use to output data from a custom user field?

PS.. i'm a "newbie" on DW and cshtml pages. 

Regards
Pål Messenlien
Vangen & Plotz AS


Replies

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply
This post has been marked as an answer

Try this 

@foreach (var location in locationList) {

var webpage = location.CustomFields.FirstOrDefault(x => x.Key == "AccessUser_Webpage").Value.Value.ToString();

Votes for this answer: 3
 
Pål Messenlien
Reply

Thanks Shiwanka, that worked great!

 

You must be logged in to post in the forum