在UpdatePanel中分页我的GridView会导致完整的回发。

时间:2012-05-16 16:46:03

标签: asp.net sql-server ajax asp.net-mvc-3 visual-studio-2010

我想在网页母版页中使用AJAX更新面板,但它不起作用 我尝试打开另一个做同样步骤的proget,它运行良好,但在这个页面它不能工作 这是代码:

<%@ Page Title="" Language="VB" MasterPageFile="~/GIAC/Accueil/GiacMasterPage.master" AutoEventWireup="false" CodeFile="Les_Dossiers_Finance.aspx.vb" Inherits="GIAC_Gestion_des_dossiers_Les_Dossiers_Finance" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Gestion_Dossier_Finance" ContentPlaceHolderID="Corps" Runat="Server">
      <center> <div id="Bar_Nav_Gestion_Dossier_Inter">
            <p id="p1"><a href="Tous_Les_Dossiers.aspx">Consulter <br /> Tous les dossiers</a></p>          
            <ul>
                <li id="li1"><a href="Les_Dossiers_Finance.aspx">Les dossiers qui sont prêts a remplir avec les information de finance</a></li>
                <li id="li2"><a href="Les_Dossiers_Rembourse.aspx">Les dossiers qui sont prêts a remplir avec les information de remboursement</a></li>
                <li id="li3"><a href="Prete_Envoyer_OFPPT.aspx">Les dossiers qui sont prêts a envoyer au OFPPT</a></li>
                <li id="li4"><a href="Deja_Envoyer_OFPPT.aspx">Les dossiers qui sont déja envoyer a OFPPT</a></li>
                <li id="li5"><a href="Retour_OFPPT.aspx">Retour de L’OFPPT  </a></li>                                                
            </ul>
            <p id="p2">Nouveau dossier</p>
       </div></center>
       <div id="BarRecherche">
            Filtrer les dossiers par : 
           <asp:DropDownList ID="RecherhcerComboBox" runat="server" ONCHANGE="Recherche()">
               <asp:ListItem Selected="True" Value="Rien">--Sélectionner le type--</asp:ListItem>
               <asp:ListItem Value="CNSS">CNSS d&#39;entreprise</asp:ListItem>
               <asp:ListItem Value="Date">Date de dépôt des dossiers</asp:ListItem>
               <asp:ListItem Value="ID">Identifiant d&#39;entreprise</asp:ListItem>
           </asp:DropDownList>

       </div>        
        <asp:Panel ID="SearchPanel" runat="server">

           <div id="CNSSRech">
               <asp:Panel ID="PanelCNSS" runat="server" >
                     Saisir la CNSS : 
                     <asp:TextBox ID="CNSSTxt" runat="server" Height="23px" placeholder="CNSS" style="font-family : Comic Sans MS, Arial, Tahoma; color:Red;"></asp:TextBox>
                   <asp:Button ID="RechercherCNSS" runat="server" Text="Rechercher" />
               </asp:Panel>  
            </div>



         <div id="IDRech">
               <asp:Panel ID="PanelID" runat="server" >
                     Saisir l'identifiant d'entreprise : 
                     <asp:TextBox ID="IDTxt" runat="server" Height="23px" 
                         placeholder="identifiant" 
                         style="font-family : Comic Sans MS, Arial, Tahoma; color:Red;" 
                         Width="91px"></asp:TextBox>
                   <asp:Button ID="RechercherID" runat="server" Text="Rechercher" />
               </asp:Panel> 
            </div> 

            <div id="DateRech">
               <asp:Panel ID="PanelDate" runat="server" >
                     Entre :  
                     <asp:TextBox ID="Date_Debut" runat="server">
                     </asp:TextBox>
                     Et :
                     <asp:TextBox ID="Date_Fin" runat="server">
                     </asp:TextBox> 
               </asp:Panel>  
            </div>
           </asp:Panel>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
            <div class="GridViewDiv">
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
              <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                  ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
                  SelectCommand="SELECT * FROM [Products]"></asp:SqlDataSource>
              <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                  AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ProductID" 
                  DataSourceID="SqlDataSource1">
                  <Columns>
                      <asp:CommandField ShowSelectButton="True" />
                      <asp:BoundField DataField="ProductID" HeaderText="ProductID" 
                          InsertVisible="False" ReadOnly="True" SortExpression="ProductID" />
                      <asp:BoundField DataField="ProductName" HeaderText="ProductName" 
                          SortExpression="ProductName" />
                      <asp:BoundField DataField="SupplierID" HeaderText="SupplierID" 
                          SortExpression="SupplierID" />
                      <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" 
                          SortExpression="CategoryID" />
                      <asp:BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" 
                          SortExpression="QuantityPerUnit" />
                      <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" 
                          SortExpression="UnitPrice" />
                      <asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" 
                          SortExpression="UnitsInStock" />
                      <asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" 
                          SortExpression="UnitsOnOrder" />
                      <asp:BoundField DataField="ReorderLevel" HeaderText="ReorderLevel" 
                          SortExpression="ReorderLevel" />
                      <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" 
                          SortExpression="Discontinued" />
                  </Columns>
              </asp:GridView>
              </ContentTemplate>
          </asp:UpdatePanel>
      </div>
</asp:Content>

1 个答案:

答案 0 :(得分:3)

您缺少UpdatePanel的ContentTemplate。

以下是UpdatePanel上的详细内容:UpdatePanel Class