Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Hyperlink and ResolveURL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tshad - 02 Aug 2007 00:00 GMT
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
vincent.apesa@gmail.com - 02 Aug 2007 00:11 GMT
Tom,
 Use   <%# ... %>  instead of <%= %>

cheers,
Vince

> I am finally getting the path to the Current Page using Page.ResolveURL.
>
[quoted text clipped - 19 lines]
>
> Tom
tshad - 02 Aug 2007 02:27 GMT
> 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
[quoted text clipped - 22 lines]
>>
>> Tom
tshad - 02 Aug 2007 02:53 GMT
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

>> Tom,
>>  Use   <%# ... %>  instead of <%= %>
[quoted text clipped - 40 lines]
>>>
>>> Tom
teemu.keiski@gmail.com - 02 Aug 2007 12:43 GMT
Did you realize you need to call DataBind() for thge Page or the
control in question for databinding expressions <%# %> to be
evaluated?

Teemu

> <vincent.ap...@gmail.com> wrote in message
>
[quoted text clipped - 45 lines]
>
> - N?yt? siteerattu teksti -
tshad - 02 Aug 2007 16:04 GMT
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.com> wrote:
> <vincent.ap...@gmail.com> wrote in message
>
[quoted text clipped - 49 lines]
>
> - Näytä siteerattu teksti -
tshad - 03 Aug 2007 01:39 GMT
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

> Did you realize you need to call DataBind() for thge Page or the
> control in question for databinding expressions <%# %> to be
[quoted text clipped - 65 lines]
>>
>> - Näytä siteerattu teksti -
tshad - 03 Aug 2007 16:07 GMT
I decided to try one more time to use the HyperLink in my Datagrid using <%#
%> and eval and unlike a Hyperlink which outside of the datagrid gives me
nothing, this does resolve the path but doesn't do it the same as when you
do it programmatically.

If I do:

 dim test as String
 test = Page.ResolveUrl("displayCompanyOverview.aspx")
 test3.NavigateURL = Page.ResolveUrl("displayCompanyOverview.aspx")

This works fine and gives you the URL:

/jobseeker/displayCompanyOverview.aspx               (the Current Page Path)

If I do:

<asp:HyperLinkColumn ItemStyle-Width="190" DataTextField="JobTitle"
DataTextFormatString="{0}" DataNavigateUrlField="PositionID"
DataNavigateUrlFormatString='<%#
Page.ResolveURL("displayPositionNS.aspx?PositionID=" + eval("{0}"))'

This gives me:

/applicant/displayPositionNS.aspx?PositionID=210     (The Controls Path

I have no idea why this is working this way.  It makes no sense to me.

It doesn't appear to be using the ResolveURL at all.  If it did, it would
resolve to the same path as when it was done programatically.

Tom

>I assume this can't be done.
>
[quoted text clipped - 82 lines]
>>>
>>> - Näytä siteerattu teksti -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.