scroll position

Discussion in 'ASP .Net' started by Guest, Nov 9, 2005.

  1. Guest

    Guest Guest

    Hi all,

    I have a long web form on asp.net 2.0. When I go at the bottom and click on
    submit, a postback occurs and if there are any validation errors (no
    client-side checking being done), the page loads again, but this time the
    scroll position is at the bottom. This is annoying, because the actual
    validation error messages are on the top and the user cannot see them. Any
    ideas? I have turned off maintainscrollbackpositiononpostback in the pages
    element in web.config. What am I missing?

    TIA!
     
    Guest, Nov 9, 2005
    #1
    1. Advertisements

  2. Do you have the MaintainScrollPositionOnPostback page attribute set in your
    page? Check your HTML at the top of the page. Do you have SmartNavigation
    on?

    -Andrew
     
    Andrew Robinson, Nov 9, 2005
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    Nopes, nothing set on the top of my page in the page attribute.... i checked
    the top of my page..
     
    Guest, Nov 10, 2005
    #3
  4. Hi Param,

    I just perform some tests on my local environment by some simple pages with
    long data items and validation controls. Seems the page will maintain
    scroll position only when I turn on "maintainScrollPositionOnPostBack"
    property. Is the problem only occurs on a particular page on your side or
    have you try building a simple page with long list item and validation
    control to see whether it also suffers the problem? If convenient, I
    suggest you post a simple reproduce page so that we can also perform some
    local test on that.

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)




    --------------------
    | From: <>
    | References: <>
    <>
    | Subject: Re: scroll position
    | Date: Wed, 9 Nov 2005 21:25:25 -0600
    | Lines: 30
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
    | X-RFC2646: Format=Flowed; Response
    | Message-ID: <#>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
    | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:356910
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | Nopes, nothing set on the top of my page in the page attribute.... i
    checked
    | the top of my page..
    |
    | | > Do you have the MaintainScrollPositionOnPostback page attribute set in
    | > your page? Check your HTML at the top of the page. Do you have
    | > SmartNavigation on?
    | >
    | > -Andrew
    | >
    | >
    | > | >> Hi all,
    | >>
    | >> I have a long web form on asp.net 2.0. When I go at the bottom and
    click
    | >> on submit, a postback occurs and if there are any validation errors
    (no
    | >> client-side checking being done), the page loads again, but this time
    the
    | >> scroll position is at the bottom. This is annoying, because the actual
    | >> validation error messages are on the top and the user cannot see them.
    | >> Any ideas? I have turned off maintainscrollbackpositiononpostback in
    the
    | >> pages element in web.config. What am I missing?
    | >>
    | >> TIA!
    | >>
    | >
    | >
    |
    |
    |
     
    Steven Cheng[MSFT], Nov 10, 2005
    #4
  5. Guest

    Guest Guest

    Steve, I had set the property to false in the web.config under pages
    element. It looks like it doesnt want to obey that setting. I have to
    actually set the property on each .aspx page at the top with the page
    attribute for it not to do that...

    Thanks
     
    Guest, Nov 10, 2005
    #5
  6. Guest

    Ferret Face Guest

    As an alternative to this Autopostback Scroll postion try sticking these
    lines just above the </form> tag in your ASPX file:

    <script language="JavaScript">
    <!--
    <%-- For Autopostback Autoscrolling feature --%>
    location.href='# <%= Request.Form("__EVENTTARGET") %>';
    //-->
    </script>

    Or with a slight enhancement:

    <script language="JavaScript">
    <!--
    <%-- For Autopostback Autoscrolling feature --%>
    <%= IIf(Len(Request.Form("__EVENTTARGET")) > 0,
    "location.href='#"& Request.Form("__EVENTTARGET") &"';", "") %>
    //-->
    </script>
     
    Ferret Face, Nov 10, 2005
    #6
  7. Thanks for the followup Param,

    I think the problem is possibly project specific. If convenient, you can
    also try creating a new web project (make sure simple page with long items
    obey the scroll setting ruls in the web.config ) and then copy your pages
    there to see whether it works.

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    --------------------
    | From: <>
    | References: <>
    <>
    <#>
    <>
    | Subject: Re: scroll position
    | Date: Thu, 10 Nov 2005 09:03:38 -0600
    | Lines: 94
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
    | X-RFC2646: Format=Flowed; Original
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
    | Path:
    TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP1
    1.phx.gbl
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:357038
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | Steve, I had set the property to false in the web.config under pages
    | element. It looks like it doesnt want to obey that setting. I have to
    | actually set the property on each .aspx page at the top with the page
    | attribute for it not to do that...
    |
    | Thanks
    |
    | | > Hi Param,
    | >
    | > I just perform some tests on my local environment by some simple pages
    | > with
    | > long data items and validation controls. Seems the page will maintain
    | > scroll position only when I turn on "maintainScrollPositionOnPostBack"
    | > property. Is the problem only occurs on a particular page on your side
    or
    | > have you try building a simple page with long list item and validation
    | > control to see whether it also suffers the problem? If convenient, I
    | > suggest you post a simple reproduce page so that we can also perform
    some
    | > local test on that.
    | >
    | > Thanks,
    | >
    | > Steven Cheng
    | > Microsoft Online Support
    | >
    | > Get Secure! www.microsoft.com/security
    | > (This posting is provided "AS IS", with no warranties, and confers no
    | > rights.)
    | >
    | >
    | >
    | >
    | > --------------------
    | > | From: <>
    | > | References: <>
    | > <>
    | > | Subject: Re: scroll position
    | > | Date: Wed, 9 Nov 2005 21:25:25 -0600
    | > | Lines: 30
    | > | X-Priority: 3
    | > | X-MSMail-Priority: Normal
    | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
    | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
    | > | X-RFC2646: Format=Flowed; Response
    | > | Message-ID: <#>
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | > | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
    | > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
    | > | Xref: TK2MSFTNGXA02.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet:356910
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | > |
    | > | Nopes, nothing set on the top of my page in the page attribute.... i
    | > checked
    | > | the top of my page..
    | > |
    | > | | > | > Do you have the MaintainScrollPositionOnPostback page attribute set
    in
    | > | > your page? Check your HTML at the top of the page. Do you have
    | > | > SmartNavigation on?
    | > | >
    | > | > -Andrew
    | > | >
    | > | >
    | > | > | > | >> Hi all,
    | > | >>
    | > | >> I have a long web form on asp.net 2.0. When I go at the bottom and
    | > click
    | > | >> on submit, a postback occurs and if there are any validation errors
    | > (no
    | > | >> client-side checking being done), the page loads again, but this
    time
    | > the
    | > | >> scroll position is at the bottom. This is annoying, because the
    | > actual
    | > | >> validation error messages are on the top and the user cannot see
    | > them.
    | > | >> Any ideas? I have turned off maintainscrollbackpositiononpostback
    in
    | > the
    | > | >> pages element in web.config. What am I missing?
    | > | >>
    | > | >> TIA!
    | > | >>
    | > | >
    | > | >
    | > |
    | > |
    | > |
    | >
    |
    |
    |
     
    Steven Cheng[MSFT], Nov 11, 2005
    #7
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.