Question about "Page Refresh on Dropdown Select"
-
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
-
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
Try setting smartNavigation = true
-
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
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 AfricaColin Davies wrote: ...can you imagine a John Simmons stalker !