我在gridview中有文本框和一个按钮。单击按钮时,文本框具有验证。但是,当第二次单击按钮时,验证事件永远不会被触发。
<asp:GridView ID="ChapterGridView"
EnableSortingAndPagingCallbacks="false"
AllowSorting="false"
AllowPaging="false"
runat="server"
AutoGenerateColumns="False"
CellPadding="2"
ForeColor="#333333"
GridLines="None"
Width="780px"
OnRowCommand="ChapterGridView_OnRowCommand"
ShowFooter="False"
AutoGenerateDeleteButton="true"
AutoGenerateEditButton="true"
onrowediting="ChapterGridView_RowEditing"
onrowdeleting="ChapterGridView_RowDeleting"
onrowcancelingedit="ChapterGridView_RowCancelingEdit"
onrowupdating="ChapterGridView_RowUpdating"
onrowupdated="ChapterGridView_RowUpdated"
DataKeyNames="ChapterId"
ValidationGroup="ChapterValidation"
Visible="true">
<FooterStyle BackColor="#eeeeee" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="*End Page" HeaderStyle-HorizontalAlign="Left">
<ItemTemplate><%# Eval("EndPage")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="EndPage" runat="Server" Text='<%# Eval("EndPage") %>'></asp:TextBox>
<asp:CustomValidator ID="TotalPagesValidator" ValidationGroup="ChapterValidation" OnServerValidate="TotalPages_ServerValidate" EnableClientScript="false" ErrorMessage="Number of pages in chapter are greater than number of pages in entire publication." Display="None" ControlToValidate="EndPage" runat="server" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="EndPage" runat="Server"></asp:TextBox>
<asp:CustomValidator ID="TotalPagesValidator2" ValidationGroup="ChapterValidation" OnServerValidate="TotalPages_ServerValidate" EnableClientScript="false" ErrorMessage="Number of pages in chapter are greater than number of pages in entire publication." Display="None" ControlToValidate="EndPage" runat="server" />
<asp:Button ID="btnInsert" runat="Server" Text="Insert" CommandName="Insert" UseSubmitBehavior="false" ValidationGroup="ChapterValidation" /></span>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
编辑的相同验证按预期工作。但不适用于“插入”按钮。有什么建议么?