473,395 Members | 2,253 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,395 software developers and data experts.

What about Anchors (#) and ASP.NET?

Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a
postback, it reloads and you end up at the top of the page ... is there
anyway to get the postback to add a #anchorname to the Address so I can keep
my location down in the page??

Regards
/Lars
Nov 18 '05 #1
5 9324
One way you can do this is inside your Page_Load event you can register some
startup javascript along the lines of document.location.hash = "mybookmark1"
which should navigate you to #mybookmark1 within your page. Register the
script block after check for IsPostBack() if you want to do this after some
user input/post back event.
"Lars Netzel" <[stop_spam]@host.topdomain> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a
postback, it reloads and you end up at the top of the page ... is there
anyway to get the postback to add a #anchorname to the Address so I can keep my location down in the page??

Regards
/Lars

Nov 18 '05 #2
On Mon, 26 Jul 2004 17:01:21 +0200, "Lars Netzel" <[stop_spam]@host.topdomain> wrote:
Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a
postback, it reloads and you end up at the top of the page ... is there
anyway to get the postback to add a #anchorname to the Address so I can keep
my location down in the page??

Regards
/Lars


You can try some javascript -

C#
if (IsPostBack)
{
Page.Controls.Add(new LiteralControl("<script language = \"javascript\">"));
Page.Controls.Add(new LiteralControl(window.location="abc.aspx#123));
Page.Controls.Add(new LiteralControl("</script>"));
}
Bobby Ryzhy
bobby @ domain below
http://weekendtech.net
Nov 18 '05 #3
Thankx!:) Works Fine!

I need to add it in every single Event that postbacks of course but I guess
thats fine!

/Lars

"Adam Barker" <ms***************@q-state.co.uk> skrev i meddelandet
news:uB**************@TK2MSFTNGP09.phx.gbl...
One way you can do this is inside your Page_Load event you can register some startup javascript along the lines of document.location.hash = "mybookmark1" which should navigate you to #mybookmark1 within your page. Register the
script block after check for IsPostBack() if you want to do this after some user input/post back event.
"Lars Netzel" <[stop_spam]@host.topdomain> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a
postback, it reloads and you end up at the top of the page ... is there
anyway to get the postback to add a #anchorname to the Address so I can

keep
my location down in the page??

Regards
/Lars


Nov 18 '05 #4
Have you looked at using SmartNavigation?

http://msdn.microsoft.com/library/de...ationTopic.asp

Greg

"Lars Netzel" <[stop_spam]@host.topdomain> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thankx!:) Works Fine!

I need to add it in every single Event that postbacks of course but I guess thats fine!

/Lars

"Adam Barker" <ms***************@q-state.co.uk> skrev i meddelandet
news:uB**************@TK2MSFTNGP09.phx.gbl...
One way you can do this is inside your Page_Load event you can register

some
startup javascript along the lines of document.location.hash =

"mybookmark1"
which should navigate you to #mybookmark1 within your page. Register the
script block after check for IsPostBack() if you want to do this after

some
user input/post back event.
"Lars Netzel" <[stop_spam]@host.topdomain> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a postback, it reloads and you end up at the top of the page ... is there anyway to get the postback to add a #anchorname to the Address so I
can keep
my location down in the page??

Regards
/Lars



Nov 18 '05 #5
Inside of your page directives, the aspx page, use the
SmartNavigation=True directive.

Example: <%@ Page Language="vb" AutoEventWireup="false"
Codebehind="yourPage.aspx.vb" Inherits="yourProject.yourPage"
SmartNavigation="True"%>

This will do all of the dirty anchor work for you when postback is
caused by an asp.net control.

Happy Coding!

Bobby Ryzhy <bo***@weekendtech.net> wrote in message news:<e7********************************@4ax.com>. ..
On Mon, 26 Jul 2004 17:01:21 +0200, "Lars Netzel" <[stop_spam]@host.topdomain> wrote:
Hello!

I have a LOOOOONG page with a bunch of panels that you can expand and
stuff.. and as you all know when you click on a servercontrol and get a
postback, it reloads and you end up at the top of the page ... is there
anyway to get the postback to add a #anchorname to the Address so I can keep
my location down in the page??

Regards
/Lars


You can try some javascript -

C#
if (IsPostBack)
{
Page.Controls.Add(new LiteralControl("<script language = \"javascript\">"));
Page.Controls.Add(new LiteralControl(window.location="abc.aspx#123));
Page.Controls.Add(new LiteralControl("</script>"));
}
Bobby Ryzhy
bobby @ domain below
http://weekendtech.net

Nov 18 '05 #6

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

Similar topics

1
by: Peter Jakobi | last post by:
Hello, I want to place two lines relative to another. The problem is, that these two lines are in different groups. Is there an possibility to set the x and y values of the second line with...
2
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
1
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
2
by: learner | last post by:
Hi, A document has many Anchors. I want to take a particular action only if some particular anchors are clicked. I mean if some anchors are clicked, i want an alert box to pop up with ok and...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
12
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of...
1
by: Alec MacLean | last post by:
Hi. I'm using VS2005 Pro to work on a website project for my company. The site has several navigation elements, all based on the standard VS2005 navigation components. I have high-level...
3
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A...
10
by: Man-wai Chang | last post by:
Why 2 reference points? -- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
1
by: Patient Guy | last post by:
I have a "hidden" anchor in the body of a doc. By "hidden," I mean that the contained text of the anchor is indistinguishable from the surrounding text, the text contained by its parent/ancestor...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.