Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Users Viewer Web Part View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/13/2012 10:59:04 AM
   
Users Viewer Web Part
Hi,

I dont want to display Username if UserNickName is empty or null. I want to display forstaname +" "+Lastname.. is it possible using following? If not suggest me some other way please.
<%# HTMLEncode(TrimSitePrefix(GetNotEmpty("UserNickname;UserName"))) %>

Thanks and regards,

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/13/2012 12:21:51 PM
   
RE:Users Viewer Web Part
Hello,

You need to concatenate two different columns you can't use the GetNotEmpty method, because it chooses just first not empty column. Please use the IfEmpty method instead:
<%# IfEmpty(Eval("UserNickName"), Eval("FirstName")+" "+Eval("LastName"), Eval("UserNickName")) %>

Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/16/2012 10:11:09 PM
   
RE:Users Viewer Web Part
Hi Jan Hermann,

I dont want to take UserNickName at all. If I am trying to take FirstName,LastName,Fullname then it is giving me blank output. Is there any way that I can take FullName over here?

Thanks and Regards,
Sachin

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/17/2012 1:05:22 AM
   
RE:Users Viewer Web Part
Hello,

If you are getting blank output on FirstName, LastName, Fullname columns, then these columns are not probably filled in. Please check you have filled these columns and please check if the Selected columns property in the User Viewer web part has all these fields (or none) specified.

Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/17/2012 2:18:30 AM
   
RE:Users Viewer Web Part
Hi,
I have checked and these fields do have values and these fields are mandatory at front end.

Thanks and regards,
Sachin

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/17/2012 2:25:16 AM
   
RE:Users Viewer Web Part
Hello,

Then it has to work. Could you please post an exact transformation code you are using for rendering information about your users?

Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/17/2012 4:53:31 AM
   
RE:Users Viewer Web Part
Following is my exact transformation:
<cms:usermenucontainer runat="server" ID="userMenuElem" MenuID="userContextMenu" Parameter='<%# Eval("UserID").ToString() %>' ContextMenuCssClass="UserContextMenu" >
<div class="member">
<div class="avatar">
<a href="<%# HTMLEncode(GetMemberProfileUrl(Eval("UserName"))) %>">
<%# GetUserAvatarImage(52, HTMLEncode(TrimSitePrefix(GetNotEmpty("UserNickname;UserName")))) %>
</a>
</div>
<div class="memberInfo">
<h3><a href="<%# HTMLEncode(GetMemberProfileUrl(Eval("UserName"))) %>" title="<%# HTMLEncode(TrimSitePrefix(GetNotEmpty("UserNickname;UserName"))) %>">
<%# IfEmpty(Eval("FullName"), Eval("FirstName")+" "+Eval("LastName"), Eval("FullName")) %>
</a></h3>
<p>
<%# MyFunctions.MemberProfileProperties(Eval("UserName")) %>
</p>
</div>
<div class="clear"> </div>
</div>
</cms:usermenucontainer>

User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/17/2012 4:56:15 AM
   
RE:Users Viewer Web Part
The problem is when a user logs in using Kentico Linked in Auth webpart then in kentico username is saved in some encrypted text format like linkedin_code-code-code format.. that I want to avoid by displaying Full Name..

User avatar
Kentico Support
Kentico Support
Accepted solutionAccepted solution
kentico_janh - 12/17/2012 6:14:58 AM
   
RE:Users Viewer Web Part
Hello,

Your transformation seems to by ok and should be able to successfully use following code:

<%# IfEmpty(Eval("FullName"), Eval("FirstName")+" "+Eval("LastName"), Eval("FullName")) %>


If this code doesn't return appropriate FullName, then please check the Selected columns property of the User Viewer web part. You can also ensure your self and you can try to render only database returned value by this code:

FullName: <%# Eval("FullName") %><br/>
FirstName: <%# Eval("FirstName") %><br/>
LastName: <%# Eval("LastName") %>


Best regards,
Jan Hermann

User avatar
Certified Developer v7
Certified  Developer v7
sachin-asentechllc - 12/18/2012 6:25:07 AM
   
RE:Users Viewer Web Part
After adding required fields FirstName,LastName and FullName in Selected columns it has worked for me..
Thanks a lot. :)

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/19/2012 2:18:23 AM
   
RE:Users Viewer Web Part
Hello,

Yes, you can add required columns to the Selected columns property or you can clear this property to select all of them by default.

Best regards,
Jan Hermann