I'm trying to create a user profile page that displays a users details but not editable. I've managed to create an editable one using the Umbraco EditProfile macro.
How do I render
@Html.TextBoxFor(m => pharmacyName, new { @class = "form-control", placeholder = "First Name", data_val_required = "The First Name field is required.", data_val = "true" })
@if (Members.IsLoggedIn() && profileModel != null){
using (Html.BeginUmbracoForm<UmbProfileController>("HandleUpdateProfile", null, new { id = "updateProfileForm" }))
{
var member = Members.GetByUsername(profileModel.UserName);
var pharmacyName = member.GetPropertyValue("pharmacyName");
var lastName = member.GetPropertyValue("lastName");
@Html.TextBoxFor(m => profileModel.Name, new { @class = "form-control", placeholder = "Display Name", data_val_required="The Display Name field is required.", data_val="true" })
@Html.TextBoxFor(m => profileModel.Email, new { @class = "form-control", placeholder = "Email", data_val_required="The Email field is required.", data_val="true" })
@Html.DisplayFor(m => pharmacyName)
@Html.TextBoxFor(m => lastName, new { @class = "form-control", placeholder = "Last Name", data_val_required = "The Last Name field is required.", data_val = "true" })
<button>Save</button>
}
}
Display Custom Member Property in Macro
Hi Folks,
I'm trying to create a user profile page that displays a users details but not editable. I've managed to create an editable one using the Umbraco EditProfile macro.
How do I render
As a string of text - not a text box?
Sorry I'm a bit of a newbie on this.
Thanks Darren
Hi Darren I think you want @Html.DisplayFor(m => m.FirstName)
Cheers Paul, this did the trick!
Darren
Final Code looked like this:
is working on a reply...