473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

creating a dynamic link in ASP.NET.....how??

jeffstl
432 Expert 256MB
I have been struggling in learning .NET. I have the datagrid and repeater controls figured out, and using readers, etc.

However, I've been trying to write out a link and use a variable as one of the parameters of the querystring as I used to in classic ASP. For example:
<a href=mypage.asp?n=" & MyParameter & ">Link</a>

How can I duplicate this functionality in ASP.NET pages???

I have tried using the link1.HRef="http://www.mypage.com?n=" & MyParameter & ""

Then printing the link on the page using the <a id="link1" runat="server">

However, the compiler doesn't seem to want to convert it and I keep getting errors. Any help would be appreciated....
Thanks
Feb 16 '08 #1
5 2858
jeffstl
432 Expert 256MB
OK I have also tried using session variables for this, with no luck.....very frustrating as it seems like this should be a simple task!

Compiler Error Message: BC30203: Identifier expected.

Source Error:

Line 34: Sub profilelink(sender As Object, e As EventArgs)
Line 35: dim CName
Line 36: CName = Session["Character"].ToString();
Line 37: response.Redirect("Scharacter.aspx?n=" & CName & "")
Line 38: End Sub
Feb 16 '08 #2
kunal pawar
297 100+
did try hyperlink in datagrid or repeater ??
Or
U have one link, and u want assign source dynamically
Feb 18 '08 #3
kenobewan
4,871 Expert 4TB
What would be even more frustrating would be to get stuck on this kind of basic problem again. That is why you need to learn the basics from a course, tutorial or book. My advice is do the hard yards now and it will pay off later. Who knows you may become an expert on this forum?
Feb 18 '08 #4
jeffstl
432 Expert 256MB
Actually I found a solution but Im not sure its a good one. I am using a literal control to print out the link.

In answer to the above question it is just a single link I am trying to print, not a table of links.

Here is what I did:
profilelink.Text = "<a href=Spage.aspx?n=" & server.UrlEncode(MyParameter) & ">Profile</a>"

Then in the page:
<asp:Literal id="profilelink" runat="server" />


Please let me know if this is an ok solution?
Thanks
Jeff
Feb 19 '08 #5
kunal pawar
297 100+
u r modified code

profilelink.Text = "<a href=Spage.aspx?n='" & server.UrlEncode(MyParameter) & "'>Profile</a>"

Or best way to use server control i.e. Hyperlink control
Feb 19 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Daniel Keller | last post by:
Hello! I'm trying to set up a page system using "dynamic" SSI. That means that I normally use the following on my website: <!--#include virtual="file.inc" --> Now I want to make this...
2
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is...
5
by: Paramesh | last post by:
Hello friends, How can i create and use dynamic link libraries with ANSI or ISO C language? Thank You,
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
2
by: SAL | last post by:
I would like to create a VB.net function, that builds a dynamic hyperlink using System.Web.UI.WebControls.HyperLink, but I can not find any examples on how to generate a dynamic hyperlink. Has...
1
by: simon | last post by:
Hello, i'm looking to create an aspx page that is basically a FAQ page i'm not sure if this can be done, but would love some help with suggestions of how to do it another way if this is not...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
12
by: Lazoris | last post by:
OK heres a newb question and I'm sorry for it, but im getting back into web design after like 5 years off and im stuck even though i should know the problem i cant seem to correct it atm. What I'm...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
1
by: skyson2ye | last post by:
Hi, guys: I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.