I have an integer variable Purchaser1PersonKey that I would like to pass as a session variable to another page. I have made
Purchaser1PersonKey the CommandArgument of my LinkButton.
I must be doing something wrong because when I breakpoint on response. redirect the session variable is empty. Any help will be appreciated. Thank you.


link button markup is here:

<asp:LinkButton ID="lnkPurchaser1" class="linkbutton" runat="server" CommandName="GoToPurchaser1" 
                    CommandArgument='<%=Purchaser1PersonKey %>'  OnCommand="lnkPurchaser1_Command"><%=Purchaser1FName & " " & Purchaser1LName%></asp:LinkButton>

Here is sub that processes the link command:

Protected Sub lnkPurchaser1_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
        Session("personid") = e.CommandArgument.ToString
        Response.Redirect("PeopleDetail.aspx")
    End Sub

Handles is missing.

Protected Sub lnkPurchaser1_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles lnkPurchaser1.Command
        Session("personid") = e.CommandArgument.ToString
        Response.Redirect("PeopleDetail.aspx")
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.