Problem with Autopostback

Discussion in 'ASP .Net' started by Jesse, Jul 17, 2003.

  1. Jesse

    Jesse Guest

    I have a relatively long page with a number of webcontrols with
    "autopostback" set to true. The contents/items/datasources of the subsequent
    webcontrols are dynamically populated depending on the selection of previous
    webcontrols' selected item.

    My question is : everytime the user selects an option from a webcontrol, due
    to the autopostback being turned on, the page refreshes itself to populate
    the subsequent controls. The problem I have is that when it refreshes, it
    always ends up showing the top of my very long page.

    Are there anyway i could somehow return to the location of the last selected
    control that triggered that event or the next control after that? Anchors
    does not work here, does it? If not, then how do i do it?

    Please help!
     
    Jesse, Jul 17, 2003
    #1
    1. Advertising

  2. Jesse

    Natty Gur Guest

    Natty Gur, Jul 17, 2003
    #2
    1. Advertising

  3. Jesse

    Jason Turim Guest

    Add the following to the page directives, it works for ie5 and above maybe
    others
    <%@Page ... SmartNavigation="true"%>

    "Jesse" <> wrote in message
    news:...
    > I have a relatively long page with a number of webcontrols with
    > "autopostback" set to true. The contents/items/datasources of the

    subsequent
    > webcontrols are dynamically populated depending on the selection of

    previous
    > webcontrols' selected item.
    >
    > My question is : everytime the user selects an option from a webcontrol,

    due
    > to the autopostback being turned on, the page refreshes itself to populate
    > the subsequent controls. The problem I have is that when it refreshes, it
    > always ends up showing the top of my very long page.
    >
    > Are there anyway i could somehow return to the location of the last

    selected
    > control that triggered that event or the next control after that? Anchors
    > does not work here, does it? If not, then how do i do it?
    >
    > Please help!
    >
    >
     
    Jason Turim, Jul 17, 2003
    #3
  4. Jesse

    Jos Branders Guest

    "Jesse" <> wrote in message
    news:...
    > I have a relatively long page with a number of webcontrols with
    > "autopostback" set to true. The contents/items/datasources of the

    subsequent
    > webcontrols are dynamically populated depending on the selection of

    previous
    > webcontrols' selected item.
    >
    > My question is : everytime the user selects an option from a webcontrol,

    due
    > to the autopostback being turned on, the page refreshes itself to populate
    > the subsequent controls. The problem I have is that when it refreshes, it
    > always ends up showing the top of my very long page.
    >
    > Are there anyway i could somehow return to the location of the last

    selected
    > control that triggered that event or the next control after that? Anchors
    > does not work here, does it? If not, then how do i do it?


    To make a workaround in other browsers apart from IE5 and 6, you could
    think of inserting a numbered bookmark with each control:
    <a name="bookmark01">&nbsp</a>

    Then, on postback, insert a script to go to the right bookmark:
    Sub InsertScriptBlock()
    Dim jScript As new System.Text.StringBuilder()
    jScript.Append("<script language='JavaScript'>")
    jScript.Append("location.href='#bookmark01';")
    jScript.Append("</scr" & "ipt>")
    Me.RegisterClientScriptBlock("Bookmark", jScript.ToString())
    End Sub

    --

    Jos Branders
     
    Jos Branders, Jul 17, 2003
    #4
  5. Jesse

    Jesse Guest

    Thank you Natty Gur!
    Thank you Jason Turim!
    Thank you Jos Branders!

    You guys just saved my life!!!

    "Jesse" <> wrote in message
    news:...
    > I have a relatively long page with a number of webcontrols with
    > "autopostback" set to true. The contents/items/datasources of the

    subsequent
    > webcontrols are dynamically populated depending on the selection of

    previous
    > webcontrols' selected item.
    >
    > My question is : everytime the user selects an option from a webcontrol,

    due
    > to the autopostback being turned on, the page refreshes itself to populate
    > the subsequent controls. The problem I have is that when it refreshes, it
    > always ends up showing the top of my very long page.
    >
    > Are there anyway i could somehow return to the location of the last

    selected
    > control that triggered that event or the next control after that? Anchors
    > does not work here, does it? If not, then how do i do it?
    >
    > Please help!
    >
    >
     
    Jesse, Jul 17, 2003
    #5
    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. Lloyd Sheen
    Replies:
    3
    Views:
    4,766
  2. Sean  Chapman

    Problem with autopostback on webcontrols

    Sean Chapman, Jan 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,894
  3. Darcy810
    Replies:
    0
    Views:
    1,474
    Darcy810
    Feb 15, 2006
  4. Replies:
    1
    Views:
    11,623
    S. Justin Gengo
    Mar 31, 2006
  5. andy
    Replies:
    0
    Views:
    637
Loading...

Share This Page