我在更新面板中有asp.net按钮控件。我不希望它发回来,但它的回帖请告诉我为什么回帖
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:FileUpload ID="fuVideo" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnUploadVideo" UseSubmitBehavior="false" Text="Use selected image" OnClick="btnUploadVideo_Click" CssClass="button close_button hi" runat="server" ClientIDMode="Static" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUploadVideo" />
</Triggers>
</asp:UpdatePanel>
</form>
答案 0 :(得分:0)
您可以覆盖更新面板内的整个控件并设置触发器..
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="fuVideo" runat="server" />
<asp:Button ID="btnUploadVideo" UseSubmitBehavior="false" Text="Use selected image" OnClick="btnUploadVideo_Click" CssClass="button close_button hi" runat="server" ClientIDMode="Static" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUploadVideo" />
</Triggers>
</asp:UpdatePanel>
</form>
注意: - 使用AsyncPostBackTrigger
而非PostBackTrigger
...