Reputation: 491
I put Two dropdownlist in my aspx page. second one is visible false. When I select some item from first DropDownList, I visible the second DropDownList. But, My Problem is when I Visible the second DropDownList, it will take me on the top of the page. so, everytime I need to scroll page down to reach dropdownlist control..
I want to when I visible the Second DropDownList, I will make sure do not go to the top of the page.
Help me out?
Upvotes: 2
Views: 411
Reputation: 17604
This is the solution MaintainScrollPositionOnPostback
you can use it as follows
<%@ Page MaintainScrollPositionOnPostback="true" %>
Here is a good link
MaintainScrollPositionOnPostback property doesn't works with mozilla
http://weblogs.asp.net/hosamkamel/archive/2007/09/07/maintain-scroll-position-after-postbacks-in-asp-net-2-0.aspx
Edit 1:-
But I will suggest you to use java-script for hiding the second drop-down list.
It will not create a round-trip to the server only for showing and hiding the drop-down list.
Upvotes: 0
Reputation: 25733
Remember that adding MaintainScrollPositionOnPostback="true"
is only half the battle won. And without a proper Browser capabilities file in App_Browsers
folder, your postback will not work correctly.
Here is my Chrome.browser file I use on all projects:
<!--
You can find existing browser definitions at
<windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers
-->
<browsers>
<browser id="NewBrowser" parentID="Mozilla">
<identification>
<userAgent match="Unique User Agent Regular Expression" />
</identification>
<capture>
<userAgent match="NewBrowser (?'version'\d+\.\d+)" />
</capture>
<capabilities>
<capability name="browser" value="My New Browser" />
<capability name="version" value="${version}" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true"/>
</capabilities>
</browser>
<browser refID="Mozilla">
<capabilities>
<capability name="xml" value="true" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true"/>
</capabilities>
</browser>
<browser refID="Safari1Plus">
<capabilities>
<capability name="supportsMaintainScrollPositionOnPostback" value="true"/>
</capabilities>
</browser>
</browsers>
Upvotes: 1