• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 652
  • Last Modified:

Passing a variable from a hyperlink

I have a list of static HTML that contains a list of users.  What I need to do is hyperlink each name and pass a string to a new page that will display user details.  On the Hyperlinks I have set a datanavigation url that has the query string /details.aspx?cn=tom but on the details page I'm not sure how to get that string.  

I know I need to access request.querystring but what is the easiest way to do that without having to put in a static entry for each user.  Can I just somehow access the variable part of the DataNavigationURL - (ie - tom)

BTW - I am using vb.net and asp 2.0
0
scooter1977
Asked:
scooter1977
  • 7
  • 5
  • 4
2 Solutions
 
Bob LearnedCommented:
What do you mean by a "list of static HTML"?

Bob
0
 
chinu1310Commented:
If you can store that usernames into database than

1) create aspx with user list in datagrid.
2) Make their names as hyperlink
3) On selected index change event of gridview take the clicked button's text property and add it to query string parameters and than redirect to that page.

0
 
scooter1977Author Commented:
A list of users that is made of of static HTML like so:

<asp:hyperLink ID="HyperLink1" runat="server" NavigateUrl="~/details.aspx?cn=username">Tom Smith</asp:HyperLink>
        Title <br />
        Department<br />
        Additional Info<br />
       Phone #<br />
        <a href="mailto:Tom@domain.com">Email Tom </a>


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Bob LearnedCommented:
How are you generating this HTML text?

Bob
0
 
scooter1977Author Commented:
it's just static HTML, it's not being generated from anywhere - I just need to know how to get the username from the  NavigateUrl="~/details.aspx?cn=username (which I set manually - it's not dynamic) into the details page with a request.querystring or whatever will work  

Normally I'd set the Request.quesrystring ("the field I want") but since there is no dynamic field for the username I don't know how to do it.



0
 
scooter1977Author Commented:
For example on Joe I have  NavigateUrl="~/details.aspx?cn=joe
on Jack I have  NavigateUrl="~/details.aspx?cn=jack
on Jill I have   NavigateUrl="~/details.aspx?cn=Jill

Does that make sense?
0
 
Bob LearnedCommented:
If you aren't generated this, then why don't you just hard code the values?

Bob
0
 
scooter1977Author Commented:
That's what I'm asking how to do ......   How do I get Joe, Jack, Jill, ect into my details page.....

On my details page I have a query that pulls info from a database based on cn=UserName

Example code please.   I'm not a .net coder so you're gonna have to help me out a little here
0
 
chinu1310Commented:
On every name links navigation url put like this.

for x
Details.aspx?user=x;

for y
Details.aspx?user=y;

Extract these values on the next page
0
 
scooter1977Author Commented:
ok......... so again.....how do I extract them on the next page.  I already have the values hard coded as I specified in my previous post

details.aspx?cn=joe
details.aspx?cn=jack
details.aspx?cn=Jill
0
 
Bob LearnedCommented:
Are you asking how to get them in or get them out from the next page:

Dim cn As String = Request.QueryString("cn")

Bob
0
 
scooter1977Author Commented:
I need to get them into the next page.

Dim cn As String = Request.QueryString("cn")

Produces: The (cn=) search filter is invalid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The (cn=) search filter is invalid.
0
 
chinu1310Commented:
If you consider  as i said than

string user = Request.QueryString("user");
0
 
chinu1310Commented:
Yeah. Thats what you have to do.
On the page load event of the next page put this and that will give you the user name.
0
 
scooter1977Author Commented:
ok - thank you chinu -  that's the part I was missing is that I had to do a request.querystring on each page.
0
 
chinu1310Commented:
Wait.

What you mean each page ? Each separate page for each user details ?
Is that what you doing ?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now