初めての投稿ですのでお手柔らかにお願いします。以下のマークアップとコード (これはすべてユーザー コントロール内にあります) に関しては、これは最初から問題なく機能します。formview がレンダリングするリストから複数の項目を削除しようとすると、問題が発生します。
アイテムを削除できますが、ページがリロードされ、削除したアイテムが消えてしまいます。その後、別のアイテムで削除をクリックしても、明らかな反応はまったくありません。背後のページのすべての関数などにブレークポイントを配置すると、実際には実行すべきすべてのことを実行していることがわかりますが、ブラウザはまったく応答しません。その後、ブラウザを手動で更新すると、削除した 2 番目のアイテムが消えてしまいます。
削除をクリックするたびにブラウザを更新する必要があり、可能であれば問題を理解してください。フォームビューとリピーターの両方で ViewStateMode="Disabled/Enabled" を別々に、または一緒に使用してみました。
追加 - キャッシュを無効にしてみました。
前もって感謝します。
<asp:FormView ID="fvDrugActiveSubstance" runat="server" DefaultMode="ReadOnly" UseSubmitBehavior="false" Width="100%">
<ItemTemplate>
<table style="border-collapse: collapse; border-spacing: 0;width: 100%;">
<tr>
<th style="width:80%;">Name</th>
<th style="width:10%;">Edit</th>
<th style="width:10%;">Delete</th>
</tr>
<asp:Repeater ID="rptrDrugActiveSubstance" runat="server" OnItemCommand="rptrDrugActiveSubstance_ItemCommand">
<ItemTemplate>
<tr class="view_table" style="">
<td>
<asp:Label Text='<%# Eval("ActiveSubstanceName") %>' ID="lblName" runat="server" />
<asp:Label Text='<%# Eval("DrugSafetyDrugCode") %>' ID="lblCode" runat="server" Visible="false" />
</td>
<td>
<img onclick='<%# String.Format("openDrugActiveSubstanceWindow( {1},{0},\"Write\" );return false;",((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugCode.ToString(),((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugActiveSubstanceCode) %>' src="/images/grid_icons/edit.png" style="cursor: pointer;" title="Edit" />
</td>
<td>
<asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("DrugSafetyDrugActiveSubstanceCode") %>' style="cursor: pointer;" CommandName="cmd_delete" ImageUrl="~/images/grid_icons/Delete.gif" ToolTip="Delete" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr class="view_table_alt">
<td>
<asp:Label Text='<%# Eval("ActiveSubstanceName") %>' ID="lblName" runat="server" />
<asp:Label Text='<%# Eval("DrugSafetyDrugCode") %>' ID="lblCode" runat="server" Visible="false" />
</td>
<td>
<img onclick='<%# String.Format("openDrugActiveSubstanceWindow( {1},{0},\"Write\" );return false;",((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugCode.ToString(),((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugActiveSubstanceCode) %>' src="/images/grid_icons/edit.png" style="cursor: pointer;" title="Edit" />
</td>
<td id="tdDelete">
<asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("DrugSafetyDrugActiveSubstanceCode") %>' style="cursor: pointer;" CommandName="cmd_delete" ImageUrl="~/images/grid_icons/Delete.gif" ToolTip="Delete" />
</td>
</tr>
</AlternatingItemTemplate>
</asp:Repeater>
</table>
</ItemTemplate>
</asp:FormView>
protected void rptrDrugActiveSubstance_ItemCommand(object source, RepeaterCommandEventArgs e)
{
drugSafetyService.DeleteDrugActiveSubstance(int.Parse(e.CommandArgument.ToString()));
Response.Redirect(HttpContext.Current.Request.Url.ToString().Split('?')[0] + "?#drugAS_accordian");
}