2014-03-14 2 views
0

빠른 정렬 및 패깅을 위해 패널을 업데이트하기 위해 그리드 뷰를 추가하기 만하면됩니다. 내 눈금보기가 잘 작동합니다. 여기 그리드 뷰를 업데이트 패널에 추가하는 방법

A control with ID 'lbut_category' i set as AsyncPostBackTrigger 

내 디자인이다 : 여기 난 그냥 하나의 트리거와 같은 하나 개의 링크 버튼을 추가 할 수 있지만,이 것은 같은 날 시간 오류를 실행할 수 있습니다 잘못된 콜백 및 포스트 돌아 가기 인수를 해결
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
     <ContentTemplate> 
      <asp:GridView ID="GV_ViewCategories" runat="server" AllowPaging="True" 
      AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
      GridLines="None" Width="100%" 
      ondatabound="GV_ViewCategories_DataBound" 
      onpageindexchanging="GV_ViewCategories_PageIndexChanging" 
      onprerender="GV_ViewCategories_PreRender" 
      onrowcommand="GV_ViewCategories_RowCommand" 
      onrowdatabound="GV_ViewCategories_RowDataBound" 
      onsorting="GV_ViewCategories_Sorting" DataKeyNames="Id"> 
      <RowStyle CssClass="grid1" HorizontalAlign="Left" /> 
      <Columns> 
       <asp:TemplateField> 
        <HeaderStyle CssClass="headinglist_bg" /> 
       </asp:TemplateField> 
       <asp:TemplateField HeaderText="Category Name" SortExpression="CategoryName"> 
        <HeaderStyle CssClass="headinglist_bg" /> 
        <ItemTemplate> 
         <asp:LinkButton ID="lbut_category" runat="server" 
          CommandArgument='<%# Eval("Id") %>' CommandName="View" 
          Text='<%# Bind("CategoryName") %>'></asp:LinkButton> 
        </ItemTemplate> 
        <HeaderTemplate> 
         <asp:LinkButton ID="lbut_sortname" runat="server" 
          CommandArgument="CategoryName" CommandName="Sort" CssClass="normaltext" 
          Font-Bold="true" Text="Category Name"></asp:LinkButton> 
         <asp:PlaceHolder ID="placeholdercategory" runat="server"></asp:PlaceHolder> 
        </HeaderTemplate> 
        <ItemStyle CssClass="quicklink" /> 
       </asp:TemplateField> 
      </Columns> 
      <EmptyDataRowStyle BorderWidth="0px" Width="0px" /> 
      <EmptyDataTemplate> 
       <asp:Label ID="Label2" runat="server" ForeColor="Red" 
        Text="No Records are found"></asp:Label> 
      </EmptyDataTemplate> 
      <PagerStyle CssClass="pager" HorizontalAlign="Center" VerticalAlign="Middle" /> 
      <PagerTemplate> 
       <table> 
        <tr> 
         <td> 
          <asp:ImageButton ID="ImageButton1" runat="server" 
           AlternateText="Go to First Page" CommandArgument="First" CommandName="Page" 
           ImageUrl="../images/1330128819_resultset_first.png" /> 
         </td> 
         <td> 
          <asp:ImageButton ID="ImageButton2" runat="server" AlternateText="Previous Page" 
           CommandArgument="Prev" CommandName="Page" 
           ImageUrl="../images/1330128981_resultset_previous.png" /> 
         </td> 
         <td> 
          Page&nbsp;<asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" 
           OnSelectedIndexChanged="ddlPages_SelectedIndexChanged"> 
          </asp:DropDownList> 
          of 
          <asp:Label ID="lblPageCount" runat="server"></asp:Label> 
         </td> 
         <td> 
          <asp:ImageButton ID="ImageButton3" runat="server" AlternateText="Next Page" 
           CommandArgument="Next" CommandName="Page" 
           ImageUrl="../images/Farm-Fresh_resultset_next.png" /> 
         </td> 
         <td> 
          <asp:ImageButton ID="ImageButton4" runat="server" 
           AlternateText="Go to Last Page" CommandArgument="Last" CommandName="Page" 
           ImageUrl="../images/1330128876_resultset_last.png" /> 
         </td> 
        </tr> 
       </table> 
      </PagerTemplate> 
      <FooterStyle CssClass="pager" VerticalAlign="Bottom" /> 
      <HeaderStyle HorizontalAlign="Left" /> 
     </asp:GridView> 
     </ContentTemplate> 
      <Triggers> 
       <asp:AsyncPostBackTrigger ControlID="GV_ViewCategories" 
        EventName="RowCommand" /> 
      </Triggers> 
     </asp:UpdatePanel> 

및 대한

나는 EnableEventValidation="false"을 설정했으나 여기서는 링크 버튼을 두 번 클릭해야합니다. 그러면 응답합니다.

여기에서 EnableEventValidation="false" 보안상의 이유로 위험 할 수 있습니다.

모든 신체에는 그 솔루션이 있습니까?

답변

1

ChildrenAsTriggers = "true"로 설정하면 updatepanel에 대한 포스트 백이 트리거되는 데 충분합니다. 이 경우 PostBackTrigger를 추가 할 필요가 없습니다. lbut_sort_person_name은 다른 명명 컨테이너, 즉 gridview 컨트롤의 행에 있기 때문에 찾을 수 없습니다.

+0

좋습니다. 다른 질문을 봅시다. –

관련 문제