2012-05-17 6 views
0

J'ai une zone de texte activée lorsqu'un bouton de lien est enfoncé. Chaque fois que je supprime le contenu de la zone de texte, j'appuie sur annuler et je veux qu'il ne fasse aucune validation. Il effectue la validation côté client et lorsque je clique sur annuler une seconde fois, la page revient comme elle le devrait. Voici mon HTML. J'ai vraiment besoin de comprendre ça. Merci.Validation Ne fonctionne pas correctement

<%@ Page Title="Account Activation Deactivation Reasoning" Language="C#" MasterPageFile="~/Forms/Site.master" 
AutoEventWireup="True" CodeBehind="ActivationDeactivationReasons.aspx.cs" Inherits="AccountManagementAdmin.UserInterface.Forms.ActivateDeactivateReasons.ActivationDeactivationReasons" %> 

<%@ MasterType VirtualPath="~/Forms/Site.Master" %> 
<asp:Content ID="cphAccNumberLookup" runat="server" ContentPlaceHolderID="cphPageContent"> 
    <div class="ContentPage"> 
     <div class="ContentPageHeader"> 
      Activation/Deactivation Account Reasons 
     </div> 
      <asp:Panel runat="server" EnableViewState="false" ID="pnlMessage" Visible="false"> 
        <asp:Label runat="server" ID="lblValidationMessage" EnableViewState="false" /> 
      </asp:Panel> 
     <br /> 
     <div class="SubSection"> 
      <div class="SubSectionHeader"> 
       Add Activation/Deactivation Reason 
      </div> 
      <table> 
       <tr> 
        <td> 
         <asp:Label ID="lblReason" runat="server" Text="Enter Reason:"></asp:Label> 
        </td> 
        <td> 
         <asp:TextBox ID="txtNewReason" runat="server" MaxLength="30" Width="206px"></asp:TextBox> 
        </td> 
        <td> 
         <asp:Button ID="btnAdd" runat="server" Text="Add" CssClass="Button" OnClick="btnAdd_Click"> 
         </asp:Button> 
        </td> 
       </tr> 
      </table> 
     </div> 
     <br /> 
     <div> 
      <table> 
       <asp:Repeater runat="server" ID="rptReasons" 
        onitemcommand="rptReasons_ItemCommand"> 
        <HeaderTemplate> 
         <thead> 
          <tr> 
           <th class="GridHeader"> 
            Reason 
           </th> 
           <td class="GridHeader"> 
           </td> 
          </tr> 
         </thead> 
        </HeaderTemplate> 
        <ItemTemplate> 
         <tr> 
          <td class="GridRow" style="text-align: left;"> 
           <asp:Label runat="server" ID="lblValue" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'/> 
           <asp:TextBox runat="server" ID="txtValue" ValidationGroup="validationGroup" Visible="false" Width="550" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>' /> 
           <asp:RequiredFieldValidator ID="rfvReasons" runat="server" ValidationGroup="validationGroup" ControlToValidate="txtValue" Display="Dynamic" ErrorMessage="Reason Cannot Be Empty"/> 
           <asp:RegularExpressionValidator runat="server" ID="regxValidator" ControlToValidate="txtValue" Display="Dynamic" ValidationExpression="^[A-Za-z0-9 *[email protected]#$%^&*()|\\?/<>=+_]+$" ErrorMessage="Reason Contains Invalid Characters"/> 
           </td> 
          <td class="GridRow" style="width: 80px;"> 
           <asp:LinkButton runat="server" ID="lbtnEdit" Text="Edit" CommandName="Edit"/> 
           <%--<asp:Panel runat="server" ID="pnlUpdateRow" Visible="false" >--%> 
            <asp:Button runat="server" ID="lbtnUpdate" Text="Update" CommandName="Update" CommandArgument= '<%# DataBinder.Eval(Container.DataItem, "Id") %>' Visible="False" ValidationGroup="validationGroup" CausesValidation="True"/> 
            <asp:Button runat="server" ID="lbtnCancel" Text="Cancel" CommandName="Cancel" Visible="False/> 
           <%--</asp:Panel>--%> 
          </td> 
         </tr> 
        </ItemTemplate> 
       </asp:Repeater> 
      </table> 
     </div> 
    </div> 
</asp:Content> 
+0

pouvez-vous envoyer votre code derrière ?? –

Répondre

0

Votre bouton d'annulation doit définir CausesValidation = "false"

+0

Je change le CausesValidation = "False" et rien ne change. – firexfighterx

Questions connexes