本文介绍了由''的ControlToValidate属性引用的Control''无法验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用户控件表单上有一个gridview,当我尝试验证它时,它给了我这个错误Control''由ControlToValidate属性引用''无法验证



这里是我的代码



I have a gridview on user control form, when i try to validate it it gives me this error Control '' referenced by the ControlToValidate property of '' cannot be validated

here is my code

<asp:GridView ID="gvUsers" runat="server" CellPadding="4"
       AutoGenerateColumns="False" Width="100%"
      DataKeyNames="Party_Number"  AllowPaging="True" PageSize="5" OnPageIndexChanging="ChangePage" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px">
       <Columns>

           <asp:TemplateField HeaderText="PORTFOLIO">
               <ItemTemplate>
                   <%# Eval("Candidate_Portfolio") %>
               </ItemTemplate>
           </asp:TemplateField>
           <asp:ImageField DataImageUrlField="Party_Logo" HeaderText="Party Logo"
               DataImageUrlFormatString="~/Images/{0}" ItemStyle-Width="80px"
               ControlStyle-Height="50px">
               <ControlStyle Width="90px"></ControlStyle>
               <ItemStyle Width="50px" />
           </asp:ImageField>

           <asp:TemplateField HeaderText="Party Name">
               <ItemTemplate>
                   <%# Eval("Party_Name") %>
               </ItemTemplate>
           </asp:TemplateField>

           <asp:ImageField DataImageUrlField="Candidate_Image" HeaderText="Candidate Photo"
               DataImageUrlFormatString="~/Images/{0}" ItemStyle-Width="80px"
               ControlStyle-Height="50px">
               <ControlStyle Width="90px"></ControlStyle>
               <ItemStyle Width="50px" />
           </asp:ImageField>

           <asp:TemplateField HeaderText="First Name">
               <ItemTemplate>
                   <%# Eval("Candidate_First_Name") %>
               </ItemTemplate>
           </asp:TemplateField>

           <asp:TemplateField HeaderText="Last Name">
               <ItemTemplate>
                   <%# Eval("Candidate_Last_Name") %>
               </ItemTemplate>
           </asp:TemplateField>

            <asp:TemplateField HeaderText="Candi Number" Visible="false">
               <ItemTemplate>
                   <asp:HiddenField ID="HiddenField1" runat="server" value='<%# Eval("Candidate_Number") %>' />
                   <asp:Label ID="Label1" runat="server" Text='<%# Eval("Candidate_Number") %>'></asp:Label>
               </ItemTemplate>
           </asp:TemplateField>

           <asp:TemplateField HeaderText="Vote">
               <ItemTemplate>
                   <asp:RequiredFieldValidator runat="server" ID="reqVote" ControlToValidate="rdbGVRow" ErrorMessage="Please Vote for Central Portfolio" ForeColor="Red">*</asp:RequiredFieldValidator>
                   <asp:RadioButton ID="rdbGVRow" onclick="javascript:CheckOtherIsCheckedByGVID(this);" runat="server" />
               </ItemTemplate>
           </asp:TemplateField>

       </Columns>
       <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
       <HeaderStyle BackColor="#003399" Font-Bold="true" ForeColor="#CCCCFF" />
       <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
       <RowStyle BackColor="White" ForeColor="#003399" />
       <SelectedRowStyle BackColor="#009999" Font-Bold="true" ForeColor="#CCFF99" />
       <SortedAscendingCellStyle BackColor="#EDF6F6" />
       <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
       <SortedDescendingCellStyle BackColor="#D6DFDF" />
       <SortedDescendingHeaderStyle BackColor="#002876" />


   </asp:GridView>

推荐答案


这篇关于由''的ControlToValidate属性引用的Control''无法验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:43