Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shaun 248 posts 475 karma points
    Nov 23, 2009 @ 18:50
    Shaun
    0

    Having trouble getting the member name to display.

    Hi. i'm using V4 and trying to use the .Net member controls to get at my member info.

    I want to display my members name on a page and have come up with a control that does the following

    protected void Page_Load(object sender, EventArgs e)
            {
                Member myMember = Member.GetCurrentMember();
                string strName = "cannot find property";
                try
                {
                    myMember.getProperty("Name").ToString();
                }
                catch
                {
                    //hmmm. something wrong here.
                }
                lblUserName.Text = strName;
            }

     

    I'm after the member name, NOT the login, but the name that appears in the umbraco admin when you're searching for a particular member.

    I've googled and can't see how to access the "default" properties of a member, of which this is one.

    Can anyone help?

     

  • Shaun 248 posts 475 karma points
    Nov 23, 2009 @ 18:53
    Shaun
    0

    I've missed out a "strName=" in that try statement, but still having the same problems. How does one edit a post on here?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Nov 23, 2009 @ 19:00
    Dirk De Grave
    0

    Shaun,

     

    A member's name can be retrieved as:

    myMember.Text;

     

    Hope this helps.

    Regards,

    /Dirk

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Nov 23, 2009 @ 22:46
    Aaron Powell
    2

    Members should be interacted via the ASP.NET Membership API, not the Member API directly. There is a section on the wiki for this.

  • Richard Soeteman 3875 posts 12037 karma points MVP
    Nov 24, 2009 @ 08:12
    Richard Soeteman
    0

    @Slace That's cool, but you can't display the MemberName using the Membership API, only the Username.

  • Shaun 248 posts 475 karma points
    Nov 24, 2009 @ 16:56
    Shaun
    0

    Thanks all. Dirks answer worked fine for me.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies