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

Hyperlink and ResolveURL

I am finally getting the path to the Current Page using Page.ResolveURL.

I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what I
was looking for.

But what is the syntax to add it into the HyperLink object?

I tried:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>

and this gives me:

http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>

I also tried <% %and had the same problem? Do I need sometype of Eval
syntax?

Thanks,

Tom
Aug 1 '07 #1
6 4596
Tom,
Use <%# ... % instead of <%= %>

cheers,
Vince

On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
I am finally getting the path to the Current Page using Page.ResolveURL.

I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what I
was looking for.

But what is the syntax to add it into the HyperLink object?

I tried:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>

and this gives me:

http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>

I also tried <% %and had the same problem? Do I need sometype of Eval
syntax?

Thanks,

Tom

Aug 1 '07 #2
<vi***********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Tom,
Use <%# ... % instead of <%= %>
I tried that here:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%# Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/>

But I am getting just plane text and it is not a link.

Am I missing something?

Thanks,

Tom
>
cheers,
Vince

On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
>I am finally getting the path to the Current Page using Page.ResolveURL.

I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what I
was looking for.

But what is the syntax to add it into the HyperLink object?

I tried:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>

and this gives me:

http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>

I also tried <% %and had the same problem? Do I need sometype of Eval
syntax?

Thanks,

Tom


Aug 2 '07 #3
I can set the NavigateURL for my Hyperlinks programmatically. For example,
I can do the following in the Page_Load event and it works fine:

test3.NavigateURL = Page.ResolveUrl("displayCompanyOverview.aspx")

This sets it fine.

But then for all my pages I will have to either set this for all the
Hyperlinks and HyperlinkColumns in my DataGrid. The former would have to be
set in Page_Load event and the later (datagrids) would have to be set in the
PreRender event (I think). What I was hoping to do was do it in the tag
itself.

Thanks,

Tom

"tshad" <t@home.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
<vi***********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
>Tom,
Use <%# ... % instead of <%= %>

I tried that here:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%# Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/>

But I am getting just plane text and it is not a link.

Am I missing something?

Thanks,

Tom
>>
cheers,
Vince

On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
>>I am finally getting the path to the Current Page using Page.ResolveURL.

I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what
I
was looking for.

But what is the syntax to add it into the HyperLink object?

I tried:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>

and this gives me:

http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>

I also tried <% %and had the same problem? Do I need sometype of Eval
syntax?

Thanks,

Tom



Aug 2 '07 #4
Did you realize you need to call DataBind() for thge Page or the
control in question for databinding expressions <%# %to be
evaluated?

Teemu

On 2 elo, 04:27, "tshad" <t...@home.comwrote:
<vincent.ap...@gmail.comwrote in message

news:11**********************@k79g2000hse.googlegr oups.com...
Tom,
Use <%# ... % instead of <%= %>

I tried that here:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%# Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/>

But I am getting just plane text and it is not a link.

Am I missing something?

Thanks,

Tom


cheers,
Vince
On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
I am finally getting the path to the Current Page using Page.ResolveURL.
I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what I
was looking for.
But what is the syntax to add it into the HyperLink object?
I tried:
<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>
and this gives me:
>http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>
I also tried <% %and had the same problem? Do I need sometype of Eval
syntax?
Thanks,
Tom- Piilota siteerattu teksti -

- Näytä siteerattu teksti -

Aug 2 '07 #5

<te**********@gmail.comwrote in message
news:11*********************@19g2000hsx.googlegrou ps.com...
Did you realize you need to call DataBind() for thge Page or the
control in question for databinding expressions <%# %to be
evaluated?

I was pretty sure of that and that was why I also tried <%= and <% neither
of which worked.

Is it possible you can't do this particular function inline?

Thanks,

Tom

Teemu

On 2 elo, 04:27, "tshad" <t...@home.comwrote:
<vincent.ap...@gmail.comwrote in message

news:11**********************@k79g2000hse.googlegr oups.com...
Tom,
Use <%# ... % instead of <%= %>

I tried that here:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%# Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/>

But I am getting just plane text and it is not a link.

Am I missing something?

Thanks,

Tom


cheers,
Vince
On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
I am finally getting the path to the Current Page using
Page.ResolveURL.
I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is what
I
was looking for.
But what is the syntax to add it into the HyperLink object?
I tried:
<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>
and this gives me:
>http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>
I also tried <% %and had the same problem? Do I need sometype of
Eval
syntax?
Thanks,
Tom- Piilota siteerattu teksti -

- Näytä siteerattu teksti -


Aug 2 '07 #6
I assume this can't be done.

I was told by some else:

"What you'll need to do then is to use the '<%# %>' data-binding expression
instead, and call Page.DataBind from the code-behind. But if you don't have
code-behind, then I don't believe you can accomplish what you want."

Since I am not using code-behind I assume this can't be done. I have tried
all kinds of combinations and can't get it to work, so I give up as it is
causing too much time.

Thanks,

Tom

"tshad" <t@home.comwrote in message
news:Ob****************@TK2MSFTNGP04.phx.gbl...
>
<te**********@gmail.comwrote in message
news:11*********************@19g2000hsx.googlegrou ps.com...
Did you realize you need to call DataBind() for thge Page or the
control in question for databinding expressions <%# %to be
evaluated?

I was pretty sure of that and that was why I also tried <%= and <% neither
of which worked.

Is it possible you can't do this particular function inline?

Thanks,

Tom

Teemu

On 2 elo, 04:27, "tshad" <t...@home.comwrote:
><vincent.ap...@gmail.comwrote in message

news:11**********************@k79g2000hse.googleg roups.com...
Tom,
Use <%# ... % instead of <%= %>

I tried that here:

<asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%# Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/>

But I am getting just plane text and it is not a link.

Am I missing something?

Thanks,

Tom


cheers,
Vince
On Aug 1, 7:00 pm, "tshad" <t...@home.comwrote:
I am finally getting the path to the Current Page using
Page.ResolveURL.
>I am now getting "/jobSeeker/displayCompanyOverview.aspx" which is
what I
was looking for.
>But what is the syntax to add it into the HyperLink object?
>I tried:
><asp:Hyperlink ID="test2" Text="HyperLink Test with ResolveURL"
NavigateUrl='<%= Page.ResolveUrl("displayCompanyOverview.aspx") %>'
runat="server"/><br>
>and this gives me:
>>http://www.stw.com/applicant/<%=%20Page.ResolveUrl("displayCompanyOverview.aspx ")%20%>
>I also tried <% %and had the same problem? Do I need sometype of
Eval
syntax?
>Thanks,
>Tom- Piilota siteerattu teksti -

- Näytä siteerattu teksti -



Aug 3 '07 #7

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

Similar topics

1
by: Nathan Sokalski | last post by:
I am using the ImageUrl property of the Hyperlink control to create a graphical Hyperlink. However, I want to change the size of the image I am using, but the generated HTML places the width/height...
4
by: Lloyd Dupont | last post by:
When I want some app resources I usually write something like: MapPath(ResolveUrl("~/App_Data/MyResource")) How could I do the same thing in a static helper method? I mean MapPath & ResolveUrl...
1
by: Nick Gilbert | last post by:
Hi, I have just migrated my .NET 1.1 site to .NET 2.0. Most things are now working except that a lot of my images aren't displaying if they referenced the image path using ~. eg: ...
4
by: SandyIsCool | last post by:
Hi, Can any one let me know what is difference between Server.mappath and Page.resolveURL and what are the situations we use them. Thanks, Sandy
2
by: SandyIsCool | last post by:
Hi I used the below code for an image button image1.imageurl="~/images/image1.jpg"; image1.imageurl=Page.ResolveUrl("~/images/image1.jpg"); Both statements work fine..
3
by: bryanp10 | last post by:
Are there any advantages/disadvantages between these two approaches: <img src="~/images/nav_01.gif" runat="server"> vs. <img src="<%=ResolveUrl("~/images/nav_01.gif")%>"> Are they more or...
3
by: Ganesh | last post by:
Hi There, It should be easy question, but i don't know how to do. How to transfer to another website from my page. I tried with linkbutton and Hyperlink but i cannot figure out always it...
20
by: tshad | last post by:
I had posted this problem earlier and just noticed that the Hyperlink is the problem. Apparently, it doesn't figure out the path correctly. It uses the path of the file it is in, even if it is...
1
by: NightOwl888 | last post by:
I have an older web project that I am trying to update with new .NET 2.0 features. I put new master pages in a subdirectory below the project directory. This particular project runs under IIS...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.