Maintaining client position on postback

Discussion in 'ASP .Net Web Controls' started by Doug Daniels, Nov 25, 2003.

  1. Doug Daniels

    Doug Daniels Guest

    Hi I was wondering if there was a simple way of
    maintaining the position of the client after they post
    back by selecting something in a asp:DropDownList with
    auto-postback on.

    I'm using it on a comics site to have the user select a
    comic and have an image control change its URL depending
    on the selection, but I don't want the page to reset to
    the top every time the user chooses a comic. Here is my
    event handler code:

    --------------------

    private void SelectComic_SelectedIndexChanged(object
    sender, System.EventArgs e)
    {
    //make sure its a valid selection
    if(this.SelectComic.SelectedIndex != -1)
    {
    this.ComicImage.ImageUrl =
    this.SelectComic.SelectedValue;
    }
    }
     
    Doug Daniels, Nov 25, 2003
    #1
    1. Advertising

  2. hi Doug,

    Enable smartnavigation.on the page. Your user wont even see the page glitch
    during a postback.

    "Doug Daniels" <_CAPS> wrote in message
    news:00c001c3b30c$e4b8c680$...
    > Hi I was wondering if there was a simple way of
    > maintaining the position of the client after they post
    > back by selecting something in a asp:DropDownList with
    > auto-postback on.
    >
    > I'm using it on a comics site to have the user select a
    > comic and have an image control change its URL depending
    > on the selection, but I don't want the page to reset to
    > the top every time the user chooses a comic. Here is my
    > event handler code:
    >
    > --------------------
    >
    > private void SelectComic_SelectedIndexChanged(object
    > sender, System.EventArgs e)
    > {
    > //make sure its a valid selection
    > if(this.SelectComic.SelectedIndex != -1)
    > {
    > this.ComicImage.ImageUrl =
    > this.SelectComic.SelectedValue;
    > }
    > }
     
    Alessandro Zifiglio, Nov 25, 2003
    #2
    1. Advertising

  3. Doug Daniels

    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

    "Doug Daniels" <_CAPS> wrote in message
    news:00c001c3b30c$e4b8c680$...
    > Hi I was wondering if there was a simple way of
    > maintaining the position of the client after they post
    > back by selecting something in a asp:DropDownList with
    > auto-postback on.
    >
    > I'm using it on a comics site to have the user select a
    > comic and have an image control change its URL depending
    > on the selection, but I don't want the page to reset to
    > the top every time the user chooses a comic. Here is my
    > event handler code:
    >
    > --------------------
    >
    > private void SelectComic_SelectedIndexChanged(object
    > sender, System.EventArgs e)
    > {
    > //make sure its a valid selection
    > if(this.SelectComic.SelectedIndex != -1)
    > {
    > this.ComicImage.ImageUrl =
    > this.SelectComic.SelectedValue;
    > }
    > }
     
    Teemu Keiski, Nov 26, 2003
    #3
    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. Sobin
    Replies:
    0
    Views:
    642
    Sobin
    Jan 3, 2008
  2. Jason
    Replies:
    9
    Views:
    8,508
    Jerry T.
    Dec 17, 2009
  3. Sobin

    HELP ME...Panel control not maintaining scroll position

    Sobin, Dec 30, 2007, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    798
    Sobin
    Dec 30, 2007
  4. prasad srirambhatla
    Replies:
    2
    Views:
    321
    Teemu Keiski
    Aug 28, 2003
  5. Brent
    Replies:
    2
    Views:
    204
    Brent
    May 15, 2008
Loading...

Share This Page