Try our conversational search powered by Generative AI!

Response redirect to an anchor

Vote:
 

Hi all!

I have an asp button like this:
<asp:LinkButton OnClick="ShowForm" ID="lnkbtn" runat="server" CssClass="smalltext" Text="Some Text"/>

And a method like this:
protected void ShowForm(object sender, EventArgs e)
        {

            TipPanel.Visible = true;
        }

 

The problem is that when a visitor clicks on the link the page jumps to the top. So I want to place an anchor <a name="foot"> and when a user clicks the link the page jumps to the anchor.

So, in the c# method, I can use Response.Redirect? What is the syntax? What is the best way do you think?

#58778
May 04, 2012 11:06
Vote:
 

If you have any server controls within your form, you could perhaps set focus to the frist one from code behind.

http://msdn.microsoft.com/en-us/library/ms178232.aspx

 

Not sure whether this would scroll the page if the control is out of view, worth a try.

 

 

#58780
May 04, 2012 13:28
Vote:
 

This works, but now TipPanel.Visible=true; wont fire.

Response.Redirect(CurrentPage.StaticLinkURL.ToString() + "#contactFormAchor");


Adam: ok I'll take a look. Thank you very much.

#58784
May 04, 2012 13:45
Vote:
 

Adam: yes yes! It did work. Perfect. Thank you so so so much.

#58786
May 04, 2012 13:52
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.