Results 1 to 3 of 3

Thread: Set value of variable upon hyperlink click - ASP.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    11

    Set value of variable upon hyperlink click - ASP.net

    Hi guys, I've currently got a listview on a asp.net webpage that displays "cottage" records from an access database. The name of each cottage is displayed as a hyperlink so when clicked brings you to another webpage. Below is the asp code for the name of the cottage.
    Code:
    <li style="">Name:
                    <asp:Hyperlink ID="Cottage_NameLabel" NavigateURL="~/Cottage.aspx" runat="server" 
                        Text='<%# Eval("Cottage_Name") %>' />
                    <br />
    This works perfectly fine when selecting a hyperlink. What I want the system to do is to set the value of a publically declared variable (set in a module) to the "Cottage_Name" of the selected hyperlink. So say if i clicked on a hyperlink that said "cottage1", the public variable is set to cottage1 and then the navigate url opens the next webpage.

    Would really appreciate it if anyone could help me do this!
    Thankyou

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    11

    Re: Set value of variable upon hyperlink click - ASP.net

    EDIT: I'm trying to set the variable so that when the page (that is loaded when the hyperlink is selected) is brought up, i can use an sql query that selects a record where the name of the cottage is equal to the value of the variable i am trying to set and then display the result on the page. Sorry if i haven't made it very clear, i'm very new to ASP web development.

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Set value of variable upon hyperlink click - ASP.net

    Have a look into Session variables

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width