将列表框滚动到顶部选择

发布于 2024-09-17 09:16:54 字数 290 浏览 1 评论 0原文

有没有办法以编程方式向下滚动多选 ListBox 以显示顶部选择?这里使用 ASP.NET。

更新(澄清): 有一个带有多选 ListBox 的表单,其中包含很多项目(国家/地区列表),因此并非所有项目同时可见。用户做出一项或多项选择并保存表单。稍后,用户返回编辑它,我想自动滚动 ListBox 以显示用户所做的第一个选择。例如,如果用户选择葡萄牙,我希望 ListBox 滚动,以便用户立即在屏幕上看到它,而不需要手动向下滚动到它。

Is there any way to programmatically scroll down a multiselect ListBox to show the top selection? Using ASP.NET here.

UPDATE (to clarify):
There's a form with a multiselect ListBox with a lot of items (country list), so not all of them are visible at the same time. The user makes one or several selections and saves the form. Later, the user goes back to edit it, and I want to automatically scroll the ListBox as to show the first selection the user made. For example, if the user selected Portugal, I want the ListBox to scroll so that the user sees it on the screen straight away, and doesn't need to manually scroll down to it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文