我在页面上加了UpdatePanel,但是只要DropDownList加上事件之后,还是一直刷新。
有什么办法可以不然控件刷新吗?ListBox也是这样。
我的代码:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="margin: 5px 5px 5px 5px;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Department:
<asp:DropDownList ID="DDL_DepartmentName" runat="server" Width="150px" Height="20px" AutoPostBack="true" OnSelectedIndexChanged="DDL_DepartmentName_SelectedIndexChanged">
</asp:DropDownList>
<td>
</tr>
<tr>
<td>
Role:<asp:ListBox ID="lb_AllUser" SelectionMode="Multiple" runat="server" Height="300px" Width="140px" DataValueField="UId" DataTextField="Content" OnSelectedIndexChanged="lb_User_SelectedIndexChanged" AutoPostBack="True"></asp:ListBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
有什么办法可以不然控件刷新吗?ListBox也是这样。
我的代码:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="margin: 5px 5px 5px 5px;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Department:
<asp:DropDownList ID="DDL_DepartmentName" runat="server" Width="150px" Height="20px" AutoPostBack="true" OnSelectedIndexChanged="DDL_DepartmentName_SelectedIndexChanged">
</asp:DropDownList>
<td>
</tr>
<tr>
<td>
Role:<asp:ListBox ID="lb_AllUser" SelectionMode="Multiple" runat="server" Height="300px" Width="140px" DataValueField="UId" DataTextField="Content" OnSelectedIndexChanged="lb_User_SelectedIndexChanged" AutoPostBack="True"></asp:ListBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<table width= "100% " border= "0 " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td>
<asp:UpdatePanel ID= "UpdatePanel1 " runat= "server ">
<ContentTemplate>
<asp:DropDownList ID= "DDL_DepartmentName " runat= "server " Width= "150px " Height= "20px " AutoPostBack= "true " OnSelectedIndexChanged= "DDL_DepartmentName_SelectedIndexChanged ">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<td>
</tr>
<tr>
<td>
Role: <asp:ListBox ID= "lb_AllUser " SelectionMode= "Multiple " runat= "server " Height= "300px " Width= "140px " DataValueField= "UId " DataTextField= "Content " OnSelectedIndexChanged= "lb_User_SelectedIndexChanged " AutoPostBack= "True "> </asp:ListBox>
</td>
</tr>
</table>
UpdatePanel用哪包哪别多包
不刷新web怎么传递事件呢。
要么就不刷新,要想把事件传递那就得刷新。
除非你在前台编写javascript
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DDL_DepartmentName" />
</Triggers>
</asp:UpdatePanel>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DDL_DepartmentName" />
<asp:AsyncPostBackTrigger ControlID="lb_AllUser " />
</Triggers>
</asp:UpdatePanel>这样不就行了嘛