473,399 Members | 3,656 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,399 software developers and data experts.

Hyperlink Repositions to top of screen

I have a Hyperlink...
<asp:HyperLink id="HyperLink1" runat="server" CssClass="LinkButton"
href="#">Add Item</asp:HyperLink></TD>

Which when clicks calls a javascript function AddItem. This linkage is
addedin the form_load of the page thus: (simple example)
HyperLink1.Attributes.Add("onClick", "addItem('" & HyperLink1.ClientID &
"','" & "123" & "','" & "321" & "')")
(
this gets written to the browser as
<a id="HyperLink1" class="LinkButton" href="#"
onClick="addItem('HyperLink1','123','321')">Add Item</a>
)

This does not produce a postback, which is good, but alas does reposition
the page the the top, which is bad.

I have a feeling that it's something to do with the href="#" in the
Hyperlink definition, but am unsure of what to use instead.

Any help would be appreciated, really.. any...
Many thanks
Jun 26 '07 #1
2 1240
href="#" means navigate to bookmark (unnamed). you can put bookmarks on
the page and jump to them or include in a url.

a common alternative is href="javascript:void(null);"
-- bruce (sqlwork.com)
Andy wrote:
I have a Hyperlink...
<asp:HyperLink id="HyperLink1" runat="server" CssClass="LinkButton"
href="#">Add Item</asp:HyperLink></TD>

Which when clicks calls a javascript function AddItem. This linkage is
addedin the form_load of the page thus: (simple example)
HyperLink1.Attributes.Add("onClick", "addItem('" & HyperLink1.ClientID &
"','" & "123" & "','" & "321" & "')")
(
this gets written to the browser as
<a id="HyperLink1" class="LinkButton" href="#"
onClick="addItem('HyperLink1','123','321')">Add Item</a>
)

This does not produce a postback, which is good, but alas does reposition
the page the the top, which is bad.

I have a feeling that it's something to do with the href="#" in the
Hyperlink definition, but am unsure of what to use instead.

Any help would be appreciated, really.. any...
Many thanks
Jun 26 '07 #2
Hey Bruce,
Thats exactly what I was after.

Many thanks!

"bruce barker" wrote:
href="#" means navigate to bookmark (unnamed). you can put bookmarks on
the page and jump to them or include in a url.

a common alternative is href="javascript:void(null);"
-- bruce (sqlwork.com)
Andy wrote:
I have a Hyperlink...
<asp:HyperLink id="HyperLink1" runat="server" CssClass="LinkButton"
href="#">Add Item</asp:HyperLink></TD>

Which when clicks calls a javascript function AddItem. This linkage is
addedin the form_load of the page thus: (simple example)
HyperLink1.Attributes.Add("onClick", "addItem('" & HyperLink1.ClientID &
"','" & "123" & "','" & "321" & "')")
(
this gets written to the browser as
<a id="HyperLink1" class="LinkButton" href="#"
onClick="addItem('HyperLink1','123','321')">Add Item</a>
)

This does not produce a postback, which is good, but alas does reposition
the page the the top, which is bad.

I have a feeling that it's something to do with the href="#" in the
Hyperlink definition, but am unsure of what to use instead.

Any help would be appreciated, really.. any...
Many thanks
Jun 26 '07 #3

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

Similar topics

27
by: aa | last post by:
Thought this question might be out of this NG's scope, there are always knowledgable people who might hava an answer. A hyperlink to a shortcut to a file returnes an empty screen, and the source...
40
by: Brian Jorgenson | last post by:
On my web page, I have a few hyperlinks with target frame of _blank. The hyperlink brings up a second window, but everytime I click on thie hperlink, it keeps bringing up a new window and not...
3
by: Doug Swanson | last post by:
So I've added a hyperlink to a screen based on a url stored in a database. The problem is that the hyperlink text is not underlined....but it becomes underlined when you hover over it. Small thing...
5
by: JerryK | last post by:
Hi, I am trying to put a hyperlink to a .cer (certificate) file on a form. Normally (on a ,htm page) when the user clicks on the hyperlink, the file is not recognized and the user is given the...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
3
by: Dominique | last post by:
Hello, I tried: <aw:HyperLink runat="server" id="hlQueuedCount" labelposition="top" labelwidth="30" command="runQuery" /> as if I use the parameter width it just affect the result of the query...
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...
4
by: stsgiri | last post by:
Hi, Need a vb code as like for control array elements(lables) --- need to hyperlink .so the microsoft word document corresponding to the location should got displayed on the screen. I need...
1
ammoos
by: ammoos | last post by:
Hi Friends I have placed hyperlink in data grid, in the Page named "List" .The process of work is that when the user click on the Hyper link in the page "List" then a new page, named "View", will...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.