为什么更新面板在选择另一个列表框中时会取消选择列表框中的当前选择?

发布于 2024-07-09 17:54:56 字数 149 浏览 6 评论 0原文

我有一个 asp:ListBox 包裹在 asp:UpdatePanel 中。 该列表框包含所有美国。 例如,如果我选择阿拉斯加,然后向下滚动以选择怀俄明州,则列表框会跳回到列表顶部,而不是停留在怀俄明州,并且取消选择阿拉斯加,但怀俄明州仍保持选中状态。 以前有人遇到过这个吗?

I have a asp:ListBox wrapped inside an asp:UpdatePanel. The list box contains all the United States. If I select Alaska, for example, and then scroll down to select Wyoming, the listbox jumps back up to the top of the list instead of staying on Wyoming and it deselects Alaska, but Wyoming remains selected. Has anyone ran into this before?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软糖 2024-07-16 17:54:56

听起来您已将列表框设置为自动回发。
这可以解释当页面或部分页面(在更新面板内)重新加载时的跳转。

至于取消选择默认选择(阿拉斯加),这是默认行为。 通过单击只能选择 1 个选项(即使您将 SelectionMode 设置为多个)。 要选择多个选项(如果启用),您需要按住 Ctrl 键并单击选项。 这是您无法直接控制的浏览器/操作系统行为。

It sounds like you have the listbox set to autopostback.
This would explain the jumping as the page or partial page (inside your Update Panel) gets reloaded.

As to deselecting the default choice (Alaska), this is default behavior. Only 1 option can be selected by clicking (even if you have SelectionMode set to multiple). To select multiple options, if enabled, you need to Ctrl-Click the options. This is browser/OS behavior you don't control directly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文