Copied to clipboard

Flag this post as spam?

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


  • Alexander Carpenter 19 posts 141 karma points
    Jul 30, 2018 @ 07:30
    Alexander Carpenter
    0

    Pass member Id from one page to another

    I am listing all members on one page and needing to link any of the individual members to their own page that shows all of the data relevant to that specific member.

    I have listed all the members, but I don't know how to pass the data from one page to another with a link. Can it be done?

  • Alexander Carpenter 19 posts 141 karma points
    Jul 30, 2018 @ 09:54
    Alexander Carpenter
    100

    Solved.

    @foreach (var member in ApplicationContext.Current.Services.MemberService.GetAllMembers())
    { //lists all members
        @member.Name
        @member.Email
        @member.GetValue("bio") //Or any custom member field
        var address = "JobApplicants?" + member.Id;
        <a href="@address">@member.Name</a>
    }
    

    Then the second template:

    @{var Id = Request.RawUrl; //Gets value from url
        var tempID = Id.Split('?').Last(); //splits unnecessary characters
        int memberID = tempID.AsInt(); //change to int because string won't work in argument
        var member = ApplicationContext.Current.Services.MemberService.GetById(memberID);
    
        @member.Name
        @member.Email
        @member.GetValue("bio") //Or any custom member property  
    }
    

    This will allow it to dynamically list the member information.

Please Sign in or register to post replies

Write your reply to:

Draft