2013-04-22 140 views
0

我有我的網上訂單的問題,我已經把我所有的內部的UpdatePanel dropdownlists和按鈕,但是當我在下拉列表中選擇某事或當我按下一個按鈕,整個頁面後回...請幫助我!這是我的代碼:` <%----%>                

工具裏面的UpdatePanel導致完全回發asp.net C#

      <strong><asp:ImageButton 
           ID="btnExcel0" runat="server" AlternateText="Export to Excel" Height="30px" 
           ImageUrl="/images/excel_icon1.png" onclick="btnExcel_Click" TabIndex="14" /> 
          </strong>&nbsp; &nbsp;&nbsp; 
          <input type="image" runat ="server" id ="Image1" src ="/images/images.jpg" onclick="javascript:CallPrint('divPivot1')" title="Print" /> 

          <br /> 
          <div id= "divPivot1"> 
          <asp:GridView ID="OrderGridView" runat="server" AllowPaging="True" 
           BorderStyle="None" CellPadding="3" DataKeyNames="Article" 
           EmptyDataText="&quot;No product added...&quot;" Font-Size="Small" HorizontalAlign="Left" 
           OnPageIndexChanging="OrderGridView_PageIndexChanging" PageSize="20" 
           TabIndex="15" Width="866px" BackColor="White" BorderColor="#CCCCCC" 
           BorderWidth="1px"> 
           <FooterStyle BackColor="White" ForeColor="#336699" /> 
           <HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" /> 
           <PagerSettings FirstPageText="First" LastPageText="Last" /> 
           <PagerStyle BackColor="White" ForeColor="#336699" HorizontalAlign="Left" /> 
           <RowStyle ForeColor="#336699" Font-Size="Small" /> 
           <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> 
           <SortedAscendingCellStyle BackColor="#F1F1F1" /> 
           <SortedAscendingHeaderStyle BackColor="#007DBB" /> 
           <SortedDescendingCellStyle BackColor="#CAC9C9" /> 
           <SortedDescendingHeaderStyle BackColor="#00547E" /> 
           <Columns> 
            <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" > 
            <ItemTemplate> 
             <asp:CheckBox ID="CheckBox1" runat="server" /> 
            </ItemTemplate> 
            </asp:TemplateField> 
            <asp:TemplateField HeaderText="Update Quantity" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="80"> 
            <ItemTemplate> 
             <asp:TextBox ID="TextBox" runat="server" Width="90" /> 
            </ItemTemplate> 
            </asp:TemplateField> 
           </Columns> 
          </asp:GridView> 
     br /> 
           <br /> 
           <asp:Label ID="lblsum" runat="server" CssClass="style19" Text="Sum Total"></asp:Label> 
          <br /> 
           <asp:Label ID="sum" runat="server" CssClass="style19"></asp:Label> 
          <br /> 
          </div> 
          <strong><asp:ImageButton ID="btnDelete" runat="server" Height="28px" 
            ImageUrl="/images/bt_Delete.jpg" onclick="btnDelete_Click" 
            OnClientClick="return DeleteConfirmation();" TabIndex="13" Width="106px" /> 
           </strong>&nbsp;&nbsp;&nbsp; &nbsp;<asp:ImageButton ID="btnUpdate" 
            runat="server" Height="28px" ImageUrl="/images/btUpdate.jpg" Width="106px" 
            OnClientClick="return UpdateConfirmation();" 
            onclick="btnUpdate_Click" /> 
          <asp:TextBox ID="username" runat="server" Height="16px" Visible="False" 
            Width="128px"></asp:TextBox> 
          <br /> 

          <asp:Label ID="Label16" runat="server" Text="Notes:" ForeColor="#336699"></asp:Label> 

          <br /> 
          <asp:TextBox ID="TextBox5" runat="server" Height="101px" TabIndex="10" 
           TextMode="MultiLine" Width="860px"></asp:TextBox> 
          <br /> 
          &nbsp;&nbsp;<asp:ImageButton 
           ID="btnSend" runat="server" ImageUrl="/images/mail2.jpg" 
           onclick="Button1_Click" AlternateText="Send your Order" 
           TabIndex="11" Height="75px" Width="90px"/><strong><asp:ImageButton 
           ID="ImageButton1" runat="server" Height="66px" 
           ImageUrl="/images/logout.png" Width="56px" 
           onclick="ImageButton1_Click" /> 
          </strong> 
          <br /> 
          <strong> 
          <asp:Label ID="Label18" runat="server" style="color: #336699" 
           Text="*Delete Product from List: Check the products which you want to remove from your list and press the delete button."></asp:Label> 
          </strong> 
        </ContentTemplate> 
        <Triggers> 
         <asp:PostBackTrigger ControlID="btnExcel0" /> 
         <asp:AsyncPostBackTrigger ControlID="ImageButton1" /> 
         <asp:AsyncPostBackTrigger ControlID="code" EventName="SelectedIndexChanged" /> 
         <asp:AsyncPostBackTrigger ControlID="type" EventName="SelectedIndexChanged" /> 
         <asp:AsyncPostBackTrigger ControlID="p" EventName="SelectedIndexChanged" /> 
         <asp:AsyncPostBackTrigger ControlID="dem" EventName="SelectedIndexChanged" /> 
         <asp:AsyncPostBackTrigger ControlID="quant" EventName="TextChanged" /> 
         <asp:AsyncPostBackTrigger ControlID="btnAdd" /> 
         <asp:AsyncPostBackTrigger ControlID="btnDelete" /> 
         <asp:AsyncPostBackTrigger ControlID="btnUpdate" /> 
         <asp:AsyncPostBackTrigger ControlID="btnSend" /> 
        </Triggers> 
       </asp:UpdatePanel>` 

回答

0

我看不到你的下拉列表中的代碼,我抓住了自己在同樣的問題一次。 我設置了下拉列表AutoPostBack = True,並在選定索引中定義了一個方法更改。 所以請確保你沒有這樣做並上傳你的完整代碼。

+0

2013-04-23 06:27:08

+0

我不知道爲什麼,但我不能上傳我的完整代碼....我不知道爲什麼,但我不能上傳我的完整代碼....我不知道爲什麼,但我不能上傳我的完整代碼....我有4個下拉列表,4個按鈕和一個gridview在updatepanel裏面。 – 2013-04-23 06:29:39

+0

因此,正如我剛纔所說的下拉菜單中包含了兩件事,即的AutoPostBack =真實事件上選擇指數變化 所以你需要將其刪除,以免後背上 你執行下拉列表中選擇的指數變化的事件裏面什麼? ? – zeeshan 2013-04-23 09:08:50

相關問題