Getting user firstname in transformation from the userid

'dipo Majekodunmi asked on April 25, 2017 23:27

Is there a readily available transformation function similar to <%# GetUserFullName(Eval<int>("UserID")) %> for getting a user's firstname?

Recent Answers


Brenden Kehren answered on April 25, 2017 23:46 (last edited on April 25, 2017 23:47)

You can use something like this, with caution, as it may error out if no user is found:

<%# UserInfoProvider.GetUserInfo(ValidationHelper.GetIntegr(Eval("UserID"), 0)).FirstName %>

0 votesVote for this answer Mark as a Correct answer

'dipo Majekodunmi answered on April 27, 2017 10:24

Thank you Brenden. It threw errors, so I'll just stay with the GetUserFullName for now.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 27, 2017 15:11

If you only need it for a one-time, unique use, then I'd just create your function right in the transformation. If you plan to use it in other places or transformations as well, then I'd go with a custom function.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.