开发者

Scroll to first selected Item in ASP.NET ListBox

is there an easy开发者_如何转开发 way to scroll an ASP.Net ListBox automatically to the first selected Item? The ListBox has SelectioMode="Multiple".

<asp:ListBox ID="LbSymptomCodesEdit" CausesValidation="true" ValidationGroup="VG_SAVE" Height="100%" Width="100%" runat="server"  SelectionMode="Multiple"></asp:ListBox>

The ListBox is in the EditItemTemplate of a FormView inside of an UpdatePanel. jQuery is possible but it would be great if there would be an asp.net serverside(or Ajax) way to achieve this because i don't want to use more client scripts than really needed(and this is only a nice to have).


I don't believe there is any server side method to achieve what you want to. For example, the ASP.Net Page option "MaintainScrollPositionOnPostback" and the validator's "SetFocusOnError" properties all inject a small amount of javascript into a page to manage this.

If you really want to be able to scroll to the first selected item, I suggest you inherit from ListBox and add code that will inject javascript (or jQuery) to control this for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜