Solved

ASP.NET url with Parameter

Posted on 2014-01-09
4
385 Views
Last Modified: 2014-01-09
I am new to creating dynamic websites using visual studio and vb.net.  My background is more in the use of Dreamweaver.  I have an aspx page which I want to add a link to another page including a parameter value.  On my code page I have the following:

'Declare variable
Dim strClient As String

'Page load
strClient = Request.QueryString("Client")

OK, now I want to add a link to the following url:
www.intranet.com/detail.asp?Client=[strClient]

What should I use to create this link and how should I go about it.  I'm sure this is probably very simple to do but I can't figure it out.  Hyperlink?  LinkButton?
0
Comment
Question by:schwientekd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 500 total points
ID: 39769031
If you do not need perform any processing on the server after the hyperlink / button is clicked, use the HyperLink control. It does not perform any postback. If you need to perform an action, such as update a database, then use the LinkButton.

For the HyperLink control, you can set the NavigateURL during the Page Load event so that it includes your parameter. You can also set it in the "HTML" page using the NavigateURL property using the <% %> tags.
0
 

Author Comment

by:schwientekd
ID: 39769091
OK, looks like I will use hyperlink for this.  I placed a Hyperlink control on the page and called it hrefClient.  In the Page Load event I added the line Me.hrefClient.NavigateUrl = "http://www.intranet.com/detail.asp?Client=1" (I left out the parameter to test this out first).

When I build the project it fails and gives the following error:
error BC30456: 'hrefClient' is not a member of 'Form1'

I believe this project was initially created in VS2005 and I am using VS2008, would that have something to do with the error message?  I don't understand why the control is not a member of the page it is on?  I'm very confused.
0
 

Author Comment

by:schwientekd
ID: 39769101
Wait, nevermind I just figured out what happened.  There was another page using the same code file.  I deleted the other page and the project builds now.
0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 39769102
How did you add the control to the ASPX page? Did you drag and drop the control onto the page from the Toolbox or did you hand code the control onto the page?
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question