Solved

ASP.NET url with Parameter

Posted on 2014-01-09
4
370 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
  • 2
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Shaun Kline earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 25

Expert Comment

by:Shaun Kline
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now