2015-01-16 117 views
0

我在彈出菜單中使用更新面板,以避免fullpostback。 我有兩個按鈕,一個是添加按鈕,另一個是更新按鈕。添加按鈕是正確的firing.update按鈕不會觸發時選擇索引在select2列表框jquery中更改。下面是我的代碼。更新按鈕不在更新面板在asp.net

<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" > 
<ContentTemplate> 
<table> 
<tr> 
<td>Customer Name:</td> 
<td><asp:ListBox ID="Customer_list" runat="server" style="width:250px" AutoPostBack="true" SelectionMode="Multiple"></asp:ListBox></td> 
<td>Favourite Name:</td> 
<td><asp:DropDownList ID="fvr_Name" runat="server" style="width:250px"  
    AutoPostBack="true" onselectedindexchanged="fvr_Name_SelectedIndexChanged" /> </td> 
</tr> 
<tr> 
<td>Name:</td> 
<td><asp:TextBox ID="Name_txt" runat="server" /></td> 
<td></td> 
<td></td> 
</tr> 
<tr> 
<td></td> 
<td><asp:Button ID="btn_Add" Text="Add" runat="server" OnClick="Add_btn_Clicked" Enabled="true" /></td> 
<td></td> 
<td><asp:Button ID="btn_Update" Text="Update" runat="server" 
    onclick="btn_Update_Click" /></td> 
</tr> 
</table> 
</ContentTemplate> 
<Triggers > 
<asp:AsyncPostBackTrigger ControlID="btn_Update" EventName="Click" /> 
</Triggers> 
</asp:UpdatePanel> 

請幫我糾正這一點。

回答

0

看到這一行的更新面板的<Triggers>部分:

<asp:AsyncPostBackTrigger ControlID="btn_Update" EventName="Click" /> 

您需要添加一個新的觸發選擇指數變化的事件:

<Triggers > 
<asp:AsyncPostBackTrigger ControlID="btn_Update" EventName="Click" /> 
<asp:AsyncPostBackTrigger ControlID="fvr_Name" EventName="SelectedIndexChanged" /> 
</Triggers> 
+0

thnkü烏拉圭回合的反應。在閱讀你的迴應後。我編輯了我發佈的代碼。但更新按鈕不工作...請幫我 –

+0

嗯,檢查了這一點:http://stackoverflow.com/questions/16439037/drop-down-list-selected-index-changed-not-working-in-update-面板 – HaukurHaf