简体   繁体   English

如何为固定div禁用自动回发

[英]How to disable the auto-postback for fixed div

HTML Code: HTML代码:

  <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
     <asp:UpdatePanel id="UpdatePanel1" runat="server">
    <ContentTemplate>
     <div>
    <table style="height: 40px">
    <tr>
    <td>

    <asp:TextBox ID="t1" runat="server" ></asp:TextBox>
     <asp:DropDownList ID="dd1" runat="server" Height="24px" 
            onselectedindexchanged="dd1_SelectedIndexChanged" Width="116px" 
            AutoPostBack="true"></asp:DropDownList>
      <asp:DropDownList ID="DropDownList1" runat="server" Height="41px" 
            onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="97px" 
            AutoPostBack="true" ></asp:DropDownList>
       <asp:DropDownList ID="DropDownList2" runat="server" 
            onselectedindexchanged="DropDownList2_SelectedIndexChanged" Width="334px" 
            AutoPostBack="true" Height="59px"></asp:DropDownList>
        <asp:Button ID="btn" runat="server" Text="display" onclick="btn_Click" /> 
     </td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </table>
    </div>
     <div id="PieChartExample">
            <table>
                <tr style='vertical-align: top'>
                    <td>
                        <div id="CategoryPickerContainer"></div>
                        <div id="SliderContainer"></div>
                    </td>
                </tr>
                <tr>
                    <td >
                        <div style="float: left;" id="PieChartContainer"></div>            
                        <div style="float: left;" id="TableContainer"></div>   

                    </td>
                </tr>
                <tr>
                    <td>
                           <div id="table"></div>
                    </td>

                </tr>
            </table>
        </div>

   </ContentTemplate>
   <Triggers>
  <asp:AsyncPostBackTrigger ControlID="btn" /> 
 </Triggers>
   </asp:UpdatePanel>
</form>

Its my for drop down and chart. 它是我的下拉列表和图表。 All dropdown AutoPostBack is "true" so at each change of value my chart will refresh.I don't want to refresh .my chart should refresh only after click btn. 所有下拉式AutoPostBack均为“ true”,因此每次更改值时,我的图表都会刷新。我不想刷新。我的图表仅在单击btn后才刷新。 Can anyone help me to achieve. 谁能帮我实现。

Set AutoPostBack to False . AutoPostBack设置为False

Alternatively. 或者。

You can keep AutoPostBack as true if you use UpdatePanels. 如果使用UpdatePanels,则可以将AutoPostBack保持为true。

Refer here for information on using UpdatePanels. 有关使用UpdatePanels的信息,请参见此处。 http://msdn.microsoft.com/en-us/library/bb399001.aspx http://msdn.microsoft.com/en-us/library/bb399001.aspx

In Page_Load put the chart loading code in if(!IsPostBack) block. Page_Load将图表加载代码放入if(!IsPostBack)块中。 And use UpdatePanel for Partial PostBack . 并将UpdatePanel用于Partial PostBack So the entire page won't get refreshed. 因此整个页面不会刷新。

Like 喜欢

<form id="form1" runat="server">
 <asp:UpdatePanel id="upForm" runat="server">
  <ContentTemplate>
    <!-- Your HTML -->
  </ContentTemplate>
 </asp:UpdatePanel>
 <Triggers>
  <asp:AsyncPostBackTrigger ControlID="btn" /> 
 </Triggers>
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM