Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Jump to bookmark

Posted on 2006-05-21
4
Medium Priority
?
445 Views
Last Modified: 2011-09-20
I have an online web application, in the form, there is a field for people to enter how many block they need for work experience, when people enter a number and hit the link button, the blocks will be generated. everything works fine, however, when people hit the link button, the form jump to the beginning of the form, what I need is it should jump to the bookmark where the blocks are created. Please help. Here is my code. THanks

My bookmark is
<a name="Create_block">Create block</a>

My sub is

Sub lnkCreateBlock (s as obect, e as eventargs)
        CreateBlock(intNumBlock)
        'I tried to add something like
        'lnkCreateBlock.Attributes.Add("onlick","<a href=""#Create_Block""></a>")
        'but it's not working
End Sub
0
Comment
Question by:CochiseCounty
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:orbulat
ID: 16731291
see if this works.
 
lnkCreateBlock.Attributes.Add("onlick","location.href='#Create_Block';return false;")
0
 
LVL 10

Expert Comment

by:orbulat
ID: 16731292
you have to "return false" for the button, otherwise the page will be refreshed if u click that linkbutton
0
 
LVL 39

Expert Comment

by:appari
ID: 16731434
try this

Sub lnkCreateBlock (s as obect, e as eventargs)
        CreateBlock(intNumBlock)
        Page.RegisterStartupScript("ShowBlock", "location.href='#Create_Block';")
        'I tried to add something like
        'lnkCreateBlock.Attributes.Add("onlick","<a href=""#Create_Block""></a>")
        'but it's not working
End Sub
0
 
LVL 39

Accepted Solution

by:
appari earned 1000 total points
ID: 16731448
i forgot to add script tags,

Sub lnkCreateBlock (s as obect, e as eventargs)
        CreateBlock(intNumBlock)
        Page.RegisterStartupScript("ShowBlock", "<script language=JavaScript>location.href='#Create_Block';</script>")
        'I tried to add something like
        'lnkCreateBlock.Attributes.Add("onlick","<a href=""#Create_Block""></a>")
        'but it's not working
End Sub
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question