ListBox
を使用して選択した値に基づいてカスケード フィルタリングを行ういくつかの es を持つページがありますAutoPostBack
。フォームは、選択されたすべての値を取得し、別の ASPX へのクロスページ投稿によって Excel ドキュメントを生成します。問題は、送信を 1 回クリックした後、選択が変更されるたびにクロスページ ポストバックが継続的に発生することです。
<asp:ScriptManager runat="server" />
<asp:UpdatePanel UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:ListBox ID="ParentItems" runat="server" SelectionMode="Multiple" AutoPostBack="true"></asp:ListBox>
<asp:ListBox ID="ChildItems" runat="server" SelectionMode="Multiple" AutoPostBack="true"></asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Submit" runat="server" PostBackUrl="~/AnotherPageThatGeneratesAnExcelDoc.aspx" />
ListBox
es のSelectedIndexChanged
イベントからクロスページ ポストバックをキャンセルするにはどうすればよいですか?
コードビハインドのイベントは次のとおりです。
Protected Sub ParentItems_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ParentItems.SelectedIndexChanged
'' do some filtering of the ChildItems ListBox
'' tried these but they do not work
''Submit.Enabled = False
''Submit.PostBackUrl = String.Empty
'' I also tried wrapping the button in a PlaceHolder and hiding/removing it, neither worked
''Buttons.Visible = False
''Buttons.Controls.Remove(Submit)
End Sub