Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET url with Parameter

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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses

972 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