Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button calling a Bookmark?

Status
Not open for further replies.

Thrakazog

Programmer
Dec 10, 2001
48
US
I need to have my page reload to the position it left after the user hits a button. I'm having trouble figuring out how to get the button click to also make the call to go to my bookmark. I'm starting with this code:

<a name="C4">Area 1</a>
<asp:button id="btn8" runat="server" Width="24px" CausesValidation="False" Text="Save" >

How do I make my button click call the bookmark above it?

Thanks,
 
You need to add an onClick event to the button such as:

onClick="location.href='#C4'
 
Thanks mbiro, but when I try that it tells me that:

'location' is not a member of 'ASP.Report_aspx'

Report.aspx is the name of the page i'm working with.

Any Ideas?
 
Instead of using the asp.net button, just use:
<input type=button value=Click onClick="location.href='#C4'">

if you use the asp:button tag, you need to add the onClick event in the code behind page.

 
Found I was going about it all wrong. Only needed this line of code in the form load:

Me.SmartNavigation = true
 
Be careful with smart navigation as it often does not work cross-browser and cross platform (Netsape and Mac). Just a FYI. I have found it much more reliable to code my own javascript events.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top