c# - 如何在没有回发的情况下使用 OnselectedIndexChange?
问题描述
我有 2 个下拉列表,我需要第一个(ActionList)来控制第二个(JustificationList)的值。问题是当我在第一个下拉列表中包含 Autopostback 时,我的整个页面都刷新了。
我尝试使用 updatePanel 和触发器,但它仍然不起作用。没有错误,只是刷新发生在 Index Changed 上。
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<input class="form-control" id="myInput" type="text"
placeholder="Search.." autocomplete="off" style="width: 80%;
margin-left: 25px; margin-bottom: 10px;">
<asp:Label Text="Update Selection" runat="server" Style="width: 80%;
margin-left: 25px; margin-bottom: 10px; color: white"></asp:Label>
<asp:DropDownList ID="ActionList" runat="server" AutoPostBack="true"
CSSclass="form-control" style="width: 80%; margin-left: 25px;
margin-bottom: 10px;" OnSelectedIndexChanged="JustificationData">
</asp:DropDownList>
<asp:DropDownList ID="JustificationList" runat="server"
CSSclass="form-control" style="width: 80%; margin-left: 25px;
margin-bottom: 10px;">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ActionList" />
</Triggers>
</asp:UpdatePanel>
请问我做错了什么?
解决方案
推荐阅读
- mysql - MySQL 查看聚合查询的性能问题
- vue.js - 使用nuxt部署后如何添加新的动态路由?
- swift - nil 签入用户默认值 (Swift 5)
- javascript - React Js Error Can't perform a React state update on an unmounted component
- python-3.x - Spark SQL 到 Pandas 的问题
- swift - VNRecognizeTextRequest 无法识别以横向模式扫描的文本
- angular - 如何指定分页显示的页码和页数(大小)?
- ios - DiffableDataSource:快照不重新加载页眉和页脚
- excel - 来自单个单元格的最大值,然后表示
- caching - nuxt 支持 Cache Busting 吗?