Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Question about "Page Refresh on Dropdown Select"

Question about "Page Refresh on Dropdown Select"

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-nethelp
3 Posts 3 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kmansari
    wrote on last edited by
    #1

    Hello everyone. I am doing a webpage using ASP.NET / C#, where I have a textbox (DISABLED by default), sitting next to a drop-down list. The dropdown has two items: when item (1) is selected, the textbox remains DISABLED. When item (2) is selected, the textbox gets enabled, and the user can enter a value into it. The problem I am facing right now is: everytime the user selects an item from the dropdown list, the page refreshes (which is what I want, so that the textbox becomes enabled). So I must keep "autopostback = true". However, when the page refreshes, I am thrown to the top of the page, rather than being able to continue from where I was on the page. Eventually, I am going to have many dropdown/textbox pairs, one pair on each row of a table. I hate getting refreshed to the top of the page and then having to scroll down everytime I select a dropdown list item. Any ideas? Thanks, -Kamran

    N P 2 Replies Last reply
    0
    • K kmansari

      Hello everyone. I am doing a webpage using ASP.NET / C#, where I have a textbox (DISABLED by default), sitting next to a drop-down list. The dropdown has two items: when item (1) is selected, the textbox remains DISABLED. When item (2) is selected, the textbox gets enabled, and the user can enter a value into it. The problem I am facing right now is: everytime the user selects an item from the dropdown list, the page refreshes (which is what I want, so that the textbox becomes enabled). So I must keep "autopostback = true". However, when the page refreshes, I am thrown to the top of the page, rather than being able to continue from where I was on the page. Eventually, I am going to have many dropdown/textbox pairs, one pair on each row of a table. I hate getting refreshed to the top of the page and then having to scroll down everytime I select a dropdown list item. Any ideas? Thanks, -Kamran

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Try setting smartNavigation = true

      1 Reply Last reply
      0
      • K kmansari

        Hello everyone. I am doing a webpage using ASP.NET / C#, where I have a textbox (DISABLED by default), sitting next to a drop-down list. The dropdown has two items: when item (1) is selected, the textbox remains DISABLED. When item (2) is selected, the textbox gets enabled, and the user can enter a value into it. The problem I am facing right now is: everytime the user selects an item from the dropdown list, the page refreshes (which is what I want, so that the textbox becomes enabled). So I must keep "autopostback = true". However, when the page refreshes, I am thrown to the top of the page, rather than being able to continue from where I was on the page. Eventually, I am going to have many dropdown/textbox pairs, one pair on each row of a table. I hate getting refreshed to the top of the page and then having to scroll down everytime I select a dropdown list item. Any ideas? Thanks, -Kamran

        P Offline
        P Offline
        Paul Watson
        wrote on last edited by
        #3

        kmansari wrote: everytime the user selects an item from the dropdown list, the page refreshes (which is what I want, so that the textbox becomes enabled). As the other reply noted smartNavigation should help. However, if all you are doing is enabling a text box then I recommend you use JavaScript on the client side to enable the text box instead of doing a whole server round trip.

        Paul Watson
        Bluegrass
        Cape Town, South Africa

        Colin Davies wrote: ...can you imagine a John Simmons stalker !

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups