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
bruce barker - 26 Jun 2007 16:46 GMT
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)
> I have a Hyperlink...
> <asp:HyperLink id="HyperLink1" runat="server" CssClass="LinkButton"
[quoted text clipped - 19 lines]
> Any help would be appreciated, really.. any...
> Many thanks
Andy - 26 Jun 2007 17:05 GMT
Hey Bruce,
Thats exactly what I was after.
Many thanks!
> href="#" means navigate to bookmark (unnamed). you can put bookmarks on
> the page and jump to them or include in a url.
[quoted text clipped - 26 lines]
> > Any help would be appreciated, really.. any...
> > Many thanks