1

我设置CausesValidation="false"为我的取消按钮,但是当我单击取消按钮时,exception(arrow)页面加载后显示几秒钟。我尝试了许多方法来禁用通过将组名添加到验证器和EnableClientScript property=false验证器但这些无法帮助我解决问题。即使我检查了很多线程,但没有人给出解决方案。如果有人遇到这个问题,请帮助我。

  <form id="form1" runat="server" >
  <div class="AdminContent">
        <asp:Label ID="Label1" runat="server"  
      CssClass="BreadcrumbActiveBig" Text="Group Membership" />
        <asp:ScriptManager ID="ScriptManager1" runat="server"> 
     </asp:ScriptManager>
        <br /><br />
        <asp:HiddenField ID="HiddenFieldProfile" runat="server" 
          />              

        <asp:FormView DefaultMode="Edit" ID="FormView1" runat="server" 
   DataSourceID="PermGroupObjectDataSource1" OnPreRender="FormView1_PreRender">
            <EditItemTemplate>
                <table>
                    <tr>
                        <td align="left" colspan="3">
                            <asp:Button ID="btnSave" 
                  runat="server" OnClick="btnSave_Click" Text="Save" Width="67px" 
        CssClass="ButtonS1"/>
    <asp:Button ID="btnCancel"  runat="server" OnClick="btnCancel_Click" 
      Text="Cancel" CssClass="ButtonS1" CausesValidation="false"  />
                        </td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="lblGrpName" 
       runat="server" Text="Group Name:" Width="138px"/></td>
                        <td><asp:TextBox ID="GroupNameTextBox" 
       MaxLength="50" runat="server" Text='<%# Bind("GroupName") %>' Width="337px"
      ReadOnly="false" />
                            <asp:RequiredFieldValidator ID="rqrgFldVldtr_GroupName" 
      ControlToValidate="GroupNameTextBox" Display="Dynamic" ErrorMessage="&lt;"
                            meta:resourcekey="RequiredFieldValidator1Resource2" 
     runat="server"  ></asp:RequiredFieldValidator>

                        </td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="lblGrpDescr" 
    runat="server" Text="Group Description:" Width="138px"/></td>
                        <td><asp:TextBox ID="GroupDescrTextBox" 
   MaxLength="255" runat="server" Text='<%# Bind("GroupDescr") %>' Width="337px" 
    ReadOnly="false" /></td>
                    </tr>
                    <tr>
                        <asp:Panel ID="managedByPanel" runat="server" 
      Visible="false">
                            <td><asp:Label ID="lblManagedByDescr" 
       runat="server" Text="Managed by:" Width="138px"/></td>
                            <td>
                                <asp:DropDownList 
     ID="managedByDropDownList" runat="server">
                                    <asp:ListItem Value="0" 
       Text="Admin" />
                                    <asp:ListItem Value="1" Text="AP Clerk admin &amp; Admin" />
                                    <asp:ListItem Value="2" Text="POC admin &amp; Admin" />
                                </asp:DropDownList>
                            </td>
                        </asp:Panel>
                    </tr>
                    <tr>
                    <asp:Panel ID="lblFilterPanel" runat="server" Visible="false">
                            <td>
                                <asp:Label ID="LabelFilter" runat="server" Text="Exclude From Document Filter" Width="150px"/>
                            </td>
                            <td>
                                <asp:CheckBox ID="chbExcludefromDocFilter" runat="server" 
                                    Checked='<%# Bind("ExcludeFromUserFilter") %>' />
                            </td>
                            </asp:Panel>
                    </tr>
                    <tr>
                        <td valign="top">
                            <asp:Label ID="lblMembers" runat="server" Text="Members:" Width="80px"/>
                        </td>
                        <td>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <div>
                                        <asp:ListBox ID="lbxMembers" runat="server" style="overflow:auto; width:500px; height:150px;" DataSourceID="MembersObjectDataSource1" DataTextField='ListName' DataValueField="UName" SelectionMode="Multiple" /><br />
                                        <asp:ObjectDataSource ID="MembersObjectDataSource1" runat="server" DataObjectTypeName="System.Collections.Generic.List`1[[Accenture.CSTPrague.eAPI.GroupMember, eAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]" SelectMethod="FetchGroupMembers" TypeName="Accenture.CSTPrague.eAPI.WebDB_Perm" UpdateMethod="StoreGroupMembers">
                                            <SelectParameters>
                                                <asp:SessionParameter Name="o" SessionField="oPermGroup" Type="Object" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </div>
                                    <asp:Button ID="btnDeleteSelected" runat="server" OnClick="btnDeleteSelected_Click" Text="Delete Selected" Width="106px" CssClass="ButtonS1" Style="margin: 4px 0px 8px 2px;" />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnDeleteSelected" EventName="Click" />
                                </Triggers>
                             </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblUserName" runat="server" Text="User name:" Width="141px"/>
                        </td>
                        <td>
                            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                <ContentTemplate>
                                <asp:Panel ID="panel1" runat="server" DefaultButton="btnAdd">
                                    <table>
                                        <tr>
                                            <td valign="top">
                                                <accenture:lookupcontrol ID="UserLookup" runat="server"
                                                    LookupCommand="usr"
                                                    MaxLength="100"
                                                    ValidationGroup="addUser"
                                                    DisableValidation="true"
                                                    />
                                            </td>
                                            <td>
                                                <asp:CustomValidator ID="cuvUserName" runat="server" ValidationGroup="addUser" 
                                                Display="Dynamic" ErrorMessage="<" EnableClientScript="false" OnServerValidate="cuvUserName_ServerValidate"
                                                ControlToValidate="UserLookup" ValidateEmptyText="true" />
                                            </td>

                                            <td valign="top">
                                                <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add User" ValidationGroup="addUser" CausesValidation="true" CssClass="ButtonS1" Style="margin: 2px 0px 8px 2px;"/>
                                            </td>
                                        </tr>
                                    </table>  
                                 </asp:Panel> 
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
                                </Triggers>
                             </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr style="vertical-align:top">
                        <asp:Panel ID="queryConditionPanel" runat="server" Visible="false">
                            <td><asp:Label ID="lblQueryCondition" runat="server" Text="Query&nbsp;Condition:" Width="138px"/></td>
                            <td><accenture:LengthLimitedMultilineTextBox ID="txtQueryCondition" runat="server" Text='<%# Bind("QueryCondition") %>' style="width:500px" TextMode="MultiLine" MaxLength="1000" Height="100px" CssClass="txtbox" /></td>
                        </asp:Panel>
                    </tr>
                </table>
            </EditItemTemplate>
            <InsertItemTemplate>
                Gid: <asp:TextBox ID="GidTextBox" runat="server" Text='<%# Bind("Gid") %>' /><br />
                GroupName: <asp:TextBox ID="GroupNameTextBox" MaxLength="50" runat="server" Text='<%# Bind("GroupName") %>' /><br />
                Id: <asp:TextBox ID="IdTextBox" runat="server" Text='<%# Bind("Id") %>'></asp:TextBox><br />
                GroupDescr: <asp:TextBox ID="GroupDescrTextBox" MaxLength="255" runat="server" Text='<%# Bind("GroupDescr") %>' /><br />
                ExcludeFromUserFilter: <asp:CheckBox ID="chbExcludefromDocFilter" runat="server" Checked='<%# Bind("ExcludeFromUserFilter") %>' /><br />
                Members: <asp:TextBox ID="MembersTextBox" runat="server" Text='<%# Bind("Members") %>' /><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                Gid: <asp:Label ID="GidLabel" runat="server" Text='<%# Bind("Gid") %>' /><br />
                GroupName: <asp:Label ID="GroupNameLabel" runat="server" Text='<%# Bind("GroupName") %>' /><br />
                Id: <asp:Label ID="IdLabel" runat="server" Text='<%# Bind("Id") %>' /><br />
                GroupDescr: <asp:Label ID="GroupDescrLabel" runat="server" Text='<%# Bind("GroupDescr") %>' /><br />
                <%--ExcludeFromUserFilter: <asp:Label ID="lblExcludefromDocFilter" runat="server" Text='<%# Bind("ExcludeFromUserFilter") %>' /><br />--%>
                Members: <asp:Label ID="MembersLabel" runat="server" Text='<%# Bind("Members") %>' /><br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
            </ItemTemplate>
        </asp:FormView>

        <asp:Label ID="lblMsg" runat="server" ForeColor="Red" />

        <asp:ObjectDataSource ID="PermGroupObjectDataSource1" runat="server" DataObjectTypeName="Accenture.CSTPrague.eAPI.PermGroup" SelectMethod="FetchPermGroupFromDB" TypeName="Accenture.CSTPrague.eAPI.WebDB_Perm" UpdateMethod="StorePermGroupToDB" OnUpdating="PermGroupObjectDataSource1_Updating">
            <SelectParameters>
                <asp:SessionParameter Name="o" SessionField="oPermGroup" Type="Object" />
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
</form>
4

1 回答 1

1

设置ValidationGroup="dddd"验证控制和想要的按钮。

编辑

因为你是使用 formview 所以你遇到了这个问题。

请查看同样的问题已解决的 威胁

于 2013-03-08T13:10:19.623 回答