473,692 Members | 2,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

referencing an anchor from within a usercontrol (ascx)

Hi,

I am trying to reference an anchor in a user control with a url. This
worked in 1.1 but no longer works in 2.0.

The ascx control is located in a "/include" folder

If you have a hyperlink control and you assign the navigateurl property =
"../#anchor" whereby you want to add this # reference to the current url the
url ends up with the #anchor twice.

In other words, instead of getting:
http://www.myweb.com?somevar=abc#anchor
it renders
http://www.myweb.com?somevar=abc#anchor#anchor

if i leave off the "../" it renders with one "#anchor" but as
http://www.myweb.com/include/#anchor

which is incorrect for what i need to do.

Any ideas why this is coming up twice and how to fix it. I don't want to
have to move the includes out of the include folder and into the root
directory of the web and then have to fix every other locations where they
are referenced with the "../"

Thanks,

Gary

Dec 20 '05 #1
3 3861
Hi Gary,

Welcome to MSDN newsgroup.
Regarding on the referencing Anchor in asp.net Uesrcontrol from its
container page question, based on my research, we can use the following
means to reference the anchor in self page:

1. directly put teh anchor name in the hyperlijnk's href attribute like:

<asp:HyperLin k ID="HyperLink2 " runat="server"
NavigateUrl="#a r2">Anchor2</asp:HyperLink>< br />

2 Or we can also inlclude the fullname of the current page together with
the anchor info. e.g:

<asp:HyperLin k ID="HyperLink3 " runat="server"
NavigateUrl="~/AnchorTestPage. aspx#ar3">Ancho r3</asp:HyperLink>< br
/>
Hope helps.Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "gary" <ga********@nos pam.nospam>
| Subject: referencing an anchor from within a usercontrol (ascx)
| Date: Mon, 19 Dec 2005 19:20:32 -0500
| Lines: 34
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <O#************ **@TK2MSFTNGP09 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: user237.209.42. 44.dsli.com 209.42.44.237
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP09.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3658 41
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hi,
|
| I am trying to reference an anchor in a user control with a url. This
| worked in 1.1 but no longer works in 2.0.
|
| The ascx control is located in a "/include" folder
|
| If you have a hyperlink control and you assign the navigateurl property =
| "../#anchor" whereby you want to add this # reference to the current url
the
| url ends up with the #anchor twice.
|
| In other words, instead of getting:
| http://www.myweb.com?somevar=abc#anchor
| it renders
| http://www.myweb.com?somevar=abc#anchor#anchor
|
| if i leave off the "../" it renders with one "#anchor" but as
| http://www.myweb.com/include/#anchor
|
| which is incorrect for what i need to do.
|
| Any ideas why this is coming up twice and how to fix it. I don't want to
| have to move the includes out of the include folder and into the root
| directory of the web and then have to fix every other locations where they
| are referenced with the "../"
|
| Thanks,
|
| Gary
|
|
|
|
|
|

Dec 20 '05 #2
Hello Steven

The first one does not work, the "#ar2" alone renders a double "#ar2#ar2".

Building the entire link from the servervariables collection, including the
query_string and then adding the "#ar2" does work.

It's got to be a bug!
"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:t4******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi Gary,

Welcome to MSDN newsgroup.
Regarding on the referencing Anchor in asp.net Uesrcontrol from its
container page question, based on my research, we can use the following
means to reference the anchor in self page:

1. directly put teh anchor name in the hyperlijnk's href attribute like:

<asp:HyperLin k ID="HyperLink2 " runat="server"
NavigateUrl="#a r2">Anchor2</asp:HyperLink>< br />

2 Or we can also inlclude the fullname of the current page together with
the anchor info. e.g:

<asp:HyperLin k ID="HyperLink3 " runat="server"
NavigateUrl="~/AnchorTestPage. aspx#ar3">Ancho r3</asp:HyperLink>< br
/>
Hope helps.Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "gary" <ga********@nos pam.nospam>
| Subject: referencing an anchor from within a usercontrol (ascx)
| Date: Mon, 19 Dec 2005 19:20:32 -0500
| Lines: 34
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <O#************ **@TK2MSFTNGP09 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: user237.209.42. 44.dsli.com 209.42.44.237
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP09.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3658 41
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hi,
|
| I am trying to reference an anchor in a user control with a url. This
| worked in 1.1 but no longer works in 2.0.
|
| The ascx control is located in a "/include" folder
|
| If you have a hyperlink control and you assign the navigateurl property
=
| "../#anchor" whereby you want to add this # reference to the current url
the
| url ends up with the #anchor twice.
|
| In other words, instead of getting:
| http://www.myweb.com?somevar=abc#anchor
| it renders
| http://www.myweb.com?somevar=abc#anchor#anchor
|
| if i leave off the "../" it renders with one "#anchor" but as
| http://www.myweb.com/include/#anchor
|
| which is incorrect for what i need to do.
|
| Any ideas why this is coming up twice and how to fix it. I don't want
to
| have to move the includes out of the include folder and into the root
| directory of the web and then have to fix every other locations where
they
| are referenced with the "../"
|
| Thanks,
|
| Gary
|
|
|
|
|
|

Dec 20 '05 #3
Seems a bit strange. Does the problem occur if you do not use Usercontrol,
directly put some anchors in a page and use some hyperlinks to pointed to
those anchors? Also, if convenient, would you attach a simple page (and
usercontrol if necessary) so that i can perform some tests on my side?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "gary" <ga********@nos pam.nospam>
| References: <O#************ **@TK2MSFTNGP09 .phx.gbl>
<t4************ **@TK2MSFTNGXA0 2.phx.gbl>
| Subject: Re: referencing an anchor from within a usercontrol (ascx)
| Date: Tue, 20 Dec 2005 10:59:01 -0500
| Lines: 103
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <eH************ *@TK2MSFTNGP12. phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: user237.209.42. 44.dsli.com 209.42.44.237
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3659 83
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hello Steven
|
| The first one does not work, the "#ar2" alone renders a double "#ar2#ar2".
|
| Building the entire link from the servervariables collection, including
the
| query_string and then adding the "#ar2" does work.
|
| It's got to be a bug!
|
|
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:t4******** ******@TK2MSFTN GXA02.phx.gbl.. .
| > Hi Gary,
| >
| > Welcome to MSDN newsgroup.
| > Regarding on the referencing Anchor in asp.net Uesrcontrol from its
| > container page question, based on my research, we can use the following
| > means to reference the anchor in self page:
| >
| > 1. directly put teh anchor name in the hyperlijnk's href attribute like:
| >
| > <asp:HyperLin k ID="HyperLink2 " runat="server"
| > NavigateUrl="#a r2">Anchor2</asp:HyperLink>< br />
| >
| > 2 Or we can also inlclude the fullname of the current page together with
| > the anchor info. e.g:
| >
| > <asp:HyperLin k ID="HyperLink3 " runat="server"
| >
NavigateUrl="~/AnchorTestPage. aspx#ar3">Ancho r3</asp:HyperLink>< br
| > />
| >
| >
| > Hope helps.Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | From: "gary" <ga********@nos pam.nospam>
| > | Subject: referencing an anchor from within a usercontrol (ascx)
| > | Date: Mon, 19 Dec 2005 19:20:32 -0500
| > | Lines: 34
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <O#************ **@TK2MSFTNGP09 .phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: user237.209.42. 44.dsli.com 209.42.44.237
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP09.phx. gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3658 41
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| > |
| > | Hi,
| > |
| > | I am trying to reference an anchor in a user control with a url. This
| > | worked in 1.1 but no longer works in 2.0.
| > |
| > | The ascx control is located in a "/include" folder
| > |
| > | If you have a hyperlink control and you assign the navigateurl
property
| > =
| > | "../#anchor" whereby you want to add this # reference to the current
url
| > the
| > | url ends up with the #anchor twice.
| > |
| > | In other words, instead of getting:
| > | http://www.myweb.com?somevar=abc#anchor
| > | it renders
| > | http://www.myweb.com?somevar=abc#anchor#anchor
| > |
| > | if i leave off the "../" it renders with one "#anchor" but as
| > | http://www.myweb.com/include/#anchor
| > |
| > | which is incorrect for what i need to do.
| > |
| > | Any ideas why this is coming up twice and how to fix it. I don't
want
| > to
| > | have to move the includes out of the include folder and into the root
| > | directory of the web and then have to fix every other locations where
| > they
| > | are referenced with the "../"
| > |
| > | Thanks,
| > |
| > | Gary
| > |
| > |
| > |
| > |
| > |
| > |
| >
|
|
|

Dec 21 '05 #4

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

Similar topics

0
1474
by: microdevsolutions | last post by:
Hello I am using ASP.NET - I have written a Custom Control (to output some information) that has a public property declared. I have a user control that is a wrapper around the above custom control. The code behind is nothing more than what is generated. The ascx is :- <%@ Control Language="vb" AutoEventWireup="false"
6
11281
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
4629
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation for me! I apologize for the length of this posting, but I wanted to make sure that I get an answer other than "Hey man, just use LoadControl!", because this is not what I want. The Task: Isolate a collection of web forms which are created as
0
1529
by: N. Demos | last post by:
Hello, I have a custom usercontrol, of which I have two instances of in my aspx page. Both the usercontrol and page have codebehind. In the page codebehind, I want a member variable for each usercontrol. My problem is that I keep getting a compiler error on the usercontrol variables in my page codebehind (BC30002: Type 'CityGeoPosSelectClass' is not defined.) For whatever reason, my usercontrol class is not being declared in the page...
0
2091
by: oliver | last post by:
QUESTION: How to access an object embedded in a UserControl through Javascript file? Another way to ask this question: How to execute script from a UserControl, accessing other objects in that UserControl? (Script attached to, and executed by, a UserControl embedded server control can ‘see’ the UserControl through the root document architecture. How to get the script to execute and ‘see’ other server controls in the...
2
1588
by: acadam | last post by:
In my application I have a usercontrol called "base" with a panel called "pnl1"; in "pnl1" I put my usercontrol. Now I would like to have 2 possibilities: from "base" to load another control called "ctl2" (and there's no problem) but I would like also to load "ctl2" from "ctl1"! The name of the control to load is "stored" into Session("activeCtl") base.ascx Page_Load code: Dim ctl As UserControl = New UserControl
0
2187
by: robgallen | last post by:
I have 2 user controls within a master page, and I would like one of them to call a function in the other. All the examples I have seen involve a page communicating with the Master page, or with a user control communicating with the Master page, not with a user control directly talking to another user control, bypassing the page itself. So, I have the following files: Haep.master - which contains:
2
1477
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi all I have a user control - mycontrol.ascx with various controls within it. mycontrol.ascx is utilised in myPage.aspx I have a class (class1) to carry out various functions, subs etc. How do I go about setting the properties of the controls within mycontrol.ascx directly from class1 Ideally what i'd like to do is various control property settings in class1
4
2480
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
8610
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9090
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8810
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5822
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4562
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2978
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1961
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.