Hyperlink Repositions to top of screen

G

Guest

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top