2011-10-08 3 views
0

ASP.NET UpdatePanel이있는 페이지가 있습니다. UpdatePanel에는 repeater가 있고 repeater에는 명령 단추가 있습니다. (아래 코드 예제를 참조하십시오.)asp.net 업데이트 패널 캡처 버튼 클릭

처음 버튼을 클릭해도 아무런 변화가 없습니다. 하지만 두 번째로 같은 버튼을 클릭하면 내가 예상했던 이벤트가 발생합니다. 나는 이것이 단순한 설명이 있다고 확신하지만 왜 그런지에 관해서는 손해보고있다. 조언이 도움이 될 것입니다.

<!-- Drivers Table --> 
        <asp:UpdatePanel runat="server" ID="DriverUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true"> 
         <ContentTemplate>  
          <asp:HiddenField runat="server" ID="DriverErrors" /> 
          <asp:Repeater ID="DriverRepeater" runat="server" OnItemDataBound="DriverRepeater_ItemDataBound" OnItemCommand="DriverRepeater_ItemCommand"> 
           <HeaderTemplate> 
            <table cellspacing="0" class="section-table"> 
             <tr> 
              <td class="bg_mid" colspan="7"><img src="/images/sections/drivers.png" alt="Drivers" /></td> 
             </tr> 
             <tr> 
              <td class="text_1 left-cell">#</td> 
              <td class="text_1">Name</td> 
              <td class="text_1">Date Of Birth</td> 
              <td class="text_1">Gender</td> 
              <td class="text_1">License #</td> 
              <td class="text_1">Relationship</td> 
              <td class="text_1" align="right">&nbsp;</td> 
             </tr> 
           </HeaderTemplate> 
           <ItemTemplate> 
             <tr id="DriverRow" runat="server"> 
              <td class="text_2 required left-cell"><asp:Label ID="DriverNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "DriverNumber")%>'></asp:Label></td> 
              <td class="text_2 required"><asp:Label ID="DriverName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'></asp:Label></td> 
              <td class="text_2 required"><asp:Label ID="BirthDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "BirthDate")%>'></asp:Label></td> 
              <td class="text_2 required"><asp:Label ID="Gender" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Gender").ToString() == "F" ? "Female" : "Male" %>'></asp:Label></td> 
              <td class="text_2 required"><asp:Label ID="DriversLicenseNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LicenseInformation.DriversLicenseNumber")%>'></asp:Label></td> 
              <td class="text_2 required"><asp:Label ID="RelationshipToApplicant" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "RelationshipToApplicant")%>'></asp:Label></td> 
              <td class="text_2 right-cell" align="right"><asp:ImageButton runat="server" ID="DriverEditButton" 
               ImageUrl="/images/edit.jpg" AlternateText="Edit" CommandName="Edit" CausesValidation="false" /></td> 
             </tr> 
           </ItemTemplate> 
           <FooterTemplate> 
            </table> 
           </FooterTemplate> 
          </asp:Repeater> 
         </ContentTemplate> 
        </asp:UpdatePanel> 
+0

방금 ​​들었던 또 다른 것. 렌더링 후 두 번째 클릭입니다. 따라서 패널에서 언제든지 업데이트를 호출하면 두 번 클릭하여 이벤트를 트리거합니다. –

+0

updatemode를 Always로 변경하면 항상 예상되는 이벤트가 발생합니까? 페이지에 다른 UpdatePanels이 있습니까? –

+0

필자는 Always로 변경하려고 시도했지만 실제로는 hte 백엔드에서 Update() 패널에 대한 호출과 함께 오류가 발생합니다. 페이지에 여러 개의 업데이트 패널이 있습니다. –

답변

0

UpdatePanel Mode="Conditional"을하고 enableviewstate="true" 당신은 정의 트리거 할 필요가 없습니다 당신은 그것없이 이루어집니다 작동합니다.

+0

THanks, 이걸 시험해보고 도움이되는지 확인합니다. –

+0

아니요,이 경우 도움이되지 않았습니다. –

관련 문제