I have a listview with multiple rows, each row corresponds to a SQL database row, populated on page load.
The listview is made up of multiple tables, each contains my columns data from my database and one hyperlink button that redirects the user to another webpage.
When the user clicks the hyperlink I would like to pass an Eval value to another webpage (serverside) without using a GET or POST request, the information must not be visible from the URL for security reasons.
I am aware of sessions objects, however, I am not sure how I can assign the eval value when the hyperlink is clicked.
I am trying to Text='<%#Eval ("ID") %>' (ID) between webpages.
<table>
<td>
<asp:HyperLink ID="HyperLink1" runat="server"
ImageUrl="TrackingPage.aspx">
<asp:ImageButton ID="ImageButton1" runat="server" CssClass="ImageBtn"
ImageUrl="Images/TrackingImg.PNG" OnClientClick="NavigateUrl" />
</asp:HyperLink>
</td>
</tr>
<tr>
<td>
<asp:Label ID="DashboardID" runat="server" CssClass="IDTextStyle"
Text='<%#Eval ("ID") %>'></asp:Label>
</td>
</table>
Any suggestions or further reading would be appreciated.
Thanks for your help.
I would recommend you to edit your image button to <asp:ImageButton ID="ImageButton1" runat="server" CssClass="ImageBtn" ImageUrl="Images/TrackingImg.PNG" OnClick="ImageButton1_Click" CommandArgument='<%#Eval ("ID") %>'/>
. You can then save id in Session
like this.
protected void ImmageButton1_Click(object sender, EventArgs e)
{
var dashboardID = ((ImageButton)sender).CommandArgument;
Session["DashboardID"] = dashboardID;
// Logic to redirect to another page
}