Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET url with Parameter

Posted on 2014-01-09
4
Medium Priority
?
398 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 27

Accepted Solution

by:
Shaun Kline earned 2000 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 27

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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 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