WebForm scroll position after PostBack

Discussion in 'ASP .Net' started by Steve Covert, Nov 10, 2003.

  1. Steve Covert

    Steve Covert Guest

    In the case of a long Webform, when a PostBack event occurrs, is there a
    technique to position the Form at where it was when the event fired?

    Similar to using an anchor tag in html to go to a specific location in a
    page.

    Thanks!
     
    Steve Covert, Nov 10, 2003
    #1
    1. Advertising

  2. Steve Covert

    Gareth Guest

    Try setting the SmartNavigation property = true

    "Steve Covert" <> wrote in message
    news:...
    > In the case of a long Webform, when a PostBack event occurrs, is there a
    > technique to position the Form at where it was when the event fired?
    >
    > Similar to using an anchor tag in html to go to a specific location in a
    > page.
    >
    > Thanks!
    >
    >
     
    Gareth, Nov 10, 2003
    #2
    1. Advertising

  3. Steve Covert

    alex bowers Guest

    You can render html to the browser that uses the Anchor
    tag to go to a specific location.
    the following code writes out an <A> tag to the browser
    (you'll need to insert it in the appropriate place), and
    runs a script that positions the form at that spot.

    [C#]
    string Arg = Request.Form["__EVENTARGUMENT"];
    n.Text += "<A name='#" + Arg + "'></A>";
    string script = "<SCRIPT
    language='javascript'>location.href='#" + Arg
    + "';</SCRIPT>";
    Page.RegisterStartupScript("posForm",script);

    You don't need to use Request.Form["__EVENTARGUMENT"],
    any string will do here but it can help if you're trying
    to determine which event that caused the postback

    alex

    >-----Original Message-----
    >In the case of a long Webform, when a PostBack event

    occurrs, is there a
    >technique to position the Form at where it was when the

    event fired?
    >
    >Similar to using an anchor tag in html to go to a

    specific location in a
    >page.
    >
    >Thanks!
    >
    >
    >.
    >
     
    alex bowers, Nov 10, 2003
    #3
  4. Steve Covert

    Teemu Keiski Guest

    http://authors.aspalliance.com/jimross/Articles/MaintainScrollPos.aspx

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "Steve Covert" <> wrote in message
    news:...
    > In the case of a long Webform, when a PostBack event occurrs, is there a
    > technique to position the Form at where it was when the event fired?
    >
    > Similar to using an anchor tag in html to go to a specific location in a
    > page.
    >
    > Thanks!
    >
    >
     
    Teemu Keiski, Nov 10, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JezB
    Replies:
    5
    Views:
    25,501
    Edward
    Jul 5, 2004
  2. ed
    Replies:
    8
    Views:
    6,094
    Ken Cox [Microsoft MVP]
    Nov 23, 2004
  3. =?Utf-8?B?cm11bnNvbjg=?=

    Panel scroll position reset on postback

    =?Utf-8?B?cm11bnNvbjg=?=, Sep 24, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    20,851
    Chris Botha
    Sep 24, 2005
  4. parm
    Replies:
    2
    Views:
    16,671
  5. Keithb
    Replies:
    0
    Views:
    1,019
    Keithb
    Oct 28, 2006
Loading...

Share This Page