0

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
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.