Hyperlink help...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am a novice programmer.
I want to have a hyperlink that looks like so: www.mycoolsite.com?a=21132.
On click I want to extract the query string and use it to query a table
within a DB (SQL Server). The stored procedure takes the query string as a
parameter and returns the actual URL the page is going to be redirectted. I
can do this using a button, but I have done little work with ASP.NET
hyperlinks. I've never used a link to query a DB using a parameter from the
link itself. I am using C#.
Can anyone please help me with some code? Don't worry about the DB stuff. I
can handle that. I only need help with the code associated with the hyperlink
(extracting the query string and using a value returned from a SP as a link
for the page to be redirected to).

Thanks,
Hector
 
I don't think you understood my problem. The code you sent me and pointed me
to deals with requesting querystrings. This is the scenario:
In my site I have a dynamic hyperlink. The hyperlink is populated from a
database based on some ID field. One of the fields of the DB is the actual
link the hyperlink points to. So when I click my own hyperlink, the link goes
to the DB using the value in its query string, retrieves the value of the URL
field for that row and redirects the user to that URL.
Thank you for your help, but it covers only half of what I want to do.

Hector
 
I don't think you understood my problem. The code you sent me and pointed me
to deals with requesting querystrings. This is the scenario:
In my site I have a dynamic hyperlink. The hyperlink is populated from a
database based on some ID field. One of the fields of the DB is the actual
link the hyperlink points to. So when I click my own hyperlink, the link goes
to the DB using the value in its query string, retrieves the value of the URL
field for that row and redirects the user to that URL.
Thank you for your help, but it covers only half of what I want to do.

Hector
 
I don't think you understood my problem. The code you sent me and pointed me
to deals with requesting querystrings. This is the scenario:
In my site I have a dynamic hyperlink. The hyperlink is populated from a
database based on some ID field. One of the fields of the DB is the actual
link the hyperlink points to. So when I click my own hyperlink, the link goes
to the DB using the value in its query string, retrieves the value of the URL
field for that row and redirects the user to that URL.
Thank you for your help, but it covers only half of what I want to do.

Hector
 
I did understand your problem and I thought you'd be grateful that I solved
half your problem.
I thought you could figure out the other part, which is simple string
concatenation.
In case I overestimated your skills, here's some code for you to explore
that can solve the other half of your problem.

MyHyperLink.NavigateUrl="Whatever.aspx?MyParameter="+
Server.UrlEncode(SomeString);

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
 
Back
Top