2012-06-12 62 views
1
<asp:UpdatePanel runat="server" ID="UpdatePanel" UpdateMode="Always"> 
    <ContentTemplate> 
     <asp:ListView ID="EditModeListView" runat="server" DataSourceID="DataSourceWrite"> 
      <itemtemplate> 
       <tr class="cat" onclick="return ApplyTRToggle(this);"> 
        <td colspan="5"><img src="/_layouts/images/COLLAPSE.GIF" class="toggle-img"/> <%# Eval("Cat.CategoryName")%></td> 
       </tr> 
       <asp:ListView ID="SubListView" runat="server" DataSource='<%# Eval("Blocks") %>' > 
        <ItemTemplate> 
         <tr class="sec" onclick="return ApplyTRToggle(this);"> 
          <td></td> 
          <td><img src="/images/COLLAPSE.GIF" /><%# Eval("Block.CategoryName")%> </td> 
          <td></td> 
          <td><%# Eval("StringFormat") != null ? String.Format(Eval("StringFormat").ToString(), Eval("BlockSum")):Eval("BlockSum") %></td> 
          <td> 
           <asp:ListView ID="SuberListView" runat="server" DataSource='<%# Eval("Crits") %>' > 
            <ItemTemplate> 
             <tr> 
              <asp:HiddenField ID="Identifier" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "ValueID")%>' /> 
              <td></td> 
              <td><%# Eval("Crit.CategoryName")%></td> 
              <td><%# Eval("CritUnit")%></td> 
              <td> 
               <asp:HiddenField runat="server" ID="IsDecimalController" Value='<%# DataBinder.Eval(Container.DataItem, "IsDecimal")%>' /> 
               <asp:TextBox runat="server" ID="ValueControl" Text='<%# DataBinder.Eval(Container.DataItem, "CritSum")%>' MaxLength="12"></asp:TextBox> 
               <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="ErrorMSG" ValidationGroup="NumbersValidation" ControlToValidate="ValueControl" Display="Dynamic"></asp:RequiredFieldValidator> 
               <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression='<%# Const.FLOAT_DIGITALS%>' ValidationGroup="NumbersValidation" ErrorMessage="ErrorMSGG" ControlToValidate="ValueControl" Display="Dynamic" /> 
              </td> 
              <td><%# DataBinder.Eval(Container.DataItem ,"Crit.Comment")%></td> 
             </tr> 
            </ItemTemplate> 
            <LayoutTemplate> 
             <div ID="itemPlaceholder" runat="server"></div> 
            </LayoutTemplate> 
           </asp:ListView> 
          </td> 
         </tr> 
        </ItemTemplate> 
        <LayoutTemplate> 
         <tr ID="itemPlaceholder" runat="server"></tr> 
        </LayoutTemplate> 
       </asp:ListView> 
      </itemtemplate> 
      <layouttemplate> 
        <table border="0" cellpadding="0" cellspacing="0" width="100%"> 
         <div runat="server" ID="itemPlaceholder"> 
         </div> 
        </table> 
       <div class="indicators-toolbar"> 
        <asp:Button runat="server" ID="saveButton" Text="Save" ValidationGroup="NumbersValidation" CausesValidation="true" onclick="saveButton_Click"/> 
        <asp:Button runat="server" ID="cancelButton" Text="Cancel" CssClass="ms-ButtonHeightWidth" CausesValidation="false" onclick="cancelButton_Click"/> 
       </div> 
      </layouttemplate> 
     </asp:ListView> 
    </ContentTemplate> 
</asp:UpdatePanel> 

這是在我的用戶控件中。問題是當鍵入沒有有效的文本或在<asp:TextBox runat="server" ID="ValueControl" Text='<%# DataBinder.Eval(Container.DataItem, "CritSum")%>' MaxLength="12"></asp:TextBox>火災requiredfield驗證器和顯示錯誤文本留空。然後按提交按鈕,什麼也沒有發生,但是然後在文本框中輸入正確的文本和沒有驗證火災提交按鈕不起作用。如何解決這個問題提交按鈕不適用於更新面板中的驗證器

回答

0

而在阿賈克斯按鈕消防點擊觸發..... 它可以幫助你

</ContentTemplate> 
     <Triggers> 
      <asp:AsyncPostBackTrigger ControlID="imgbtnSubmit" EventName="Click" /> 
     </Triggers> 
    </asp:UpdatePanel>