473,322 Members | 1,473 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,322 software developers and data experts.

place c# inside aspx

Hi,

I have to set the url of a link from the codebehind.

I want to call the GetLink function which returns a string.

<<a href= <<% GetLink(); %>>My Link<</a>>

- Thanks,
Nov 15 '05 #1
3 24276
> Hi,
I have to set the url of a link from the codebehind.
I want to call the GetLink function which returns a string.
<<a href= <<% GetLink(); %>>My Link<</a>>

- Thanks,


Well, if you want to do it in the .aspx file, it goes like this:

<a href="<%= GetLink() %>">Click here</a>

And GetLing() is a function that returns the link (it can be declared and
implemented in the .aspx.cs file or in the .aspx file, wherever you want).

Now, if you want to, you could use a HyperLink control and set it's
NavigateUrl property in the .aspx.cs file:

private HyperLink myLink;

public void Load(...) {
:
:
// set the URL
myLink.NavigateUrl = "/downloads/traci.mpg";
}

I hope that helps,
-JG
Nov 15 '05 #2
I believe this is what you're looking for:

<<a href= <<% Response.Write(GetLink()); %>>My Link<</a>>

Chris

"Coder Coder" <co*******@yahoo.com> wrote in message
news:f5*************************@posting.google.co m...
Hi,

I have to set the url of a link from the codebehind.

I want to call the GetLink function which returns a string.

<<a href= <<% GetLink(); %>>My Link<</a>>

- Thanks,

Nov 15 '05 #3
I believe this is what you're looking for:

<<a href= <<% Response.Write(GetLink()); %>>My Link<</a>>

Chris

"Coder Coder" <co*******@yahoo.com> wrote in message
news:f5*************************@posting.google.co m...
Hi,

I have to set the url of a link from the codebehind.

I want to call the GetLink function which returns a string.

<<a href= <<% GetLink(); %>>My Link<</a>>

- Thanks,

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hasani \(remove nospam from address\) | last post by:
I have a website with 2 aspx pages Foo.aspx, and bar.aspx The content of both files is //in 1 file Hello <%=Session.ToString()%> ================
4
by: pei_world | last post by:
in asp or php, we can use inner output command to print out text or other thing inside out web page. I want to know how to do this in asp.net. I know user control with placesholder can do, but if...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
2
by: ALI-R | last post by:
Hi I've created a bunch user comtrols for the footer,header,navigation bar of a webpage ,I have two problems: 1) All the controls are in the folder "Control" of the root and all the images...
0
by: Reza Nabi | last post by:
Dear All: Banckgroud: I have a datagrid which lives inside a repeater. Which is working fine. What i need is to dyanamically set the column width of the grid (which lieves inside the repeater)....
8
by: antonyliu2002 | last post by:
Hi, gurus: For VB.NET, if I have a variable myString somewhere inside <% and %> in a page called mypage.aspx like so: <% '.... some code here myString = "Junkie.txt" '.... some other code...
3
by: JimCinLA | last post by:
I use a place holder to load different user controls on an .aspx page. Let's call this default.aspx. Each user controls contains about a dozen different ASP.Net controls. My question is, how...
7
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi everybody, I'm using a system.timers.timer object like this: Dim aTimer As New System.Timers.Timer() In my page_load event I use this: aTimer.Interval = 5000 aTimer.Enabled = True...
2
by: Reggie | last post by:
Hi and TIA! I have a class file located in my root directory with all me web pages. I call/use the class and it works fine. I have no imports statements aspx or codebehind. My question is why? ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.