Display name in Admin section after Welcome

May 30, 2011 at 10:08 PM

Hi friends,

I've this little problem in the Admin section, that I don't understand: I select a link in the "tabs toprounded" menu and the Welcome shows my DisplayName; when I select the "extensions" option, it shows my "First Name" proprety.

This is the code

<%= Resources.labels.welcome %>  <%= UserProfile() == null ? Page.User.Identity.Name : UserProfile().DisplayName %>
So, how can I fix?
Thanks a lot, bye! :)
May 30, 2011 at 10:28 PM

Which version of BE are you using?  Some of the recent builds are using Razor for the Extensions pages in the control panel.  These Razor pages have their own master layout file, so it might work differently there.

If you're using BE 2.0, the same master page layout is used for the entire control panel.

May 31, 2011 at 7:05 PM

Hi Ben,

I'm using developer version of  BE

May 31, 2011 at 8:23 PM

Extensions page in your version probably uses razor (.cshtml) master page. So admin/_Layout.cshtml would need to incorporate same logic as above.

May 31, 2011 at 10:41 PM
Edited May 31, 2011 at 10:43 PM

Thanks Rtur,

I found it, as you say, in the _Layout.cshtml:

@Resources.labels.welcome @AuthorProfile.GetProfile(Security.CurrentUser.Identity.Name)

So, I don't know razor engine, and how can I convert it?

Jun 1, 2011 at 2:26 AM

This should work:

@Resources.labels.welcome&nbsp;@if (AuthorProfile.GetProfile(Security.CurrentUser.Identity.Name) == null)
{ @Page.User.Identity.Name }
{ @AuthorProfile.GetProfile(Security.CurrentUser.Identity.Name).DisplayName }

Jun 1, 2011 at 7:33 AM

Thanks, thanks, thanks, thanks a lot! :D