1

我正在尝试在嵌套控件的网格视图中验证 RadioButton 列表,但验证不起作用!这是我的用户界面:

        <asp:gridview runat="server" id="gvGroups" cssclass="grid_noBorder" width="100%" border="0"
        showheader="False" autogeneratecolumns="False">
            <Columns>
                <asp:TemplateField >
                    <ItemTemplate>
                         <uc1:wucInspection_GroupElements ID="wucInspection_GroupElements1" formGroupID='<%#Eval("FormGroupID") %>' taskID='<%# GetTaskID() %>' runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate >  
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                <td align="center" class="formLabelTd">
                <asp:Label ID="lblNoData"   runat="server"  meta:resourcekey="lblNoDataResource" />
                </td>
                </tr>
                </table> 
            </EmptyDataTemplate>
        </asp:gridview>

    </td>
</tr>
<tr>
    <td colspan="4" class="formButton">
        <asp:button id="btnSend" runat="server" ValidationGroup="Send" meta:resourcekey="btnSendResource" cssclass="btn"
            onclick="btnSend_Click" />
        <asp:button id="btnSave" runat="server" meta:resourcekey="btnSaveResource" cssclass="btn"
            onclick="btnSave_Click" />
        <dev:backbutton id="btnBack" runat="server" cssclass="btn" text='<%$ Resources:SCTACommonMessages,Back %>' />
    </td>
</tr>

这是嵌套控件:

    <asp:gridview runat="server" id="gvElements" autogeneratecolumns="False" cssclass="grid_tbl"
            headerstyle-cssclass="grid_titlebg" datakeynames="FormElementID" width="100%"                
             pagesize="15" GridLines="None" >
                <Columns>                        
                    <asp:TemplateField meta:resourcekey="ElementTitleResource">
                        <ItemTemplate >
                            <asp:Label ID="lblElementTitleLabel" runat="server" Text='<%#  DataBinder.Eval(Container.DataItem, "Element.ElementTitle")  %>' />
                        </ItemTemplate>
                    </asp:TemplateField> 
                     <asp:TemplateField visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblElementIDLabel" runat="server" Text='<%#  DataBinder.Eval(Container.DataItem, "Element.ElementID")  %>' />
                        </ItemTemplate>
                    </asp:TemplateField> 
                     <asp:TemplateField visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblFormElementIDLabel" runat="server" Text='<%#  Eval("FormElementID")  %>' />
                        </ItemTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField meta:resourcekey="AnswerResource">
                        <ItemTemplate>
                            <asp:radiobuttonlist id="rblAnswer" 
                             runat="server" repeatdirection="Horizontal" class="rdSelect">
            <asp:ListItem meta:resourcekey="listItemNoResource" Value="0" ></asp:ListItem>
            <asp:ListItem meta:resourcekey="listItemYesResource" Value="1"></asp:ListItem>               
        </asp:radiobuttonlist>
        <asp:requiredfieldvalidator id="rfvRblAnswer" initialvalue="-1" runat="server" Enabled ='<%# Eval("AnswerIsRequired") %>'
            controltovalidate="rblAnswer" display="Dynamic" ValidationGroup="Send" meta:resourcekey="rfvRblAnswerResource"></asp:requiredfieldvalidator>
                        </ItemTemplate>
                    </asp:TemplateField>                                                                    
                   <asp:TemplateField meta:resourcekey="NotesResource">
                        <ItemTemplate>
                            <dev:TextBox ID="txtNotes" MaxLength="100" runat="server" CssClass="formTextBox" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField  meta:resourcekey="AttachmentsResource">
                    <ItemTemplate>
                    <asp:gridview runat="server" cssclass="grid_noBorder"  width="100%"  id="gvAttachments"  autogeneratecolumns="False" ShowHeader="False">
                    <Columns>
                    <asp:TemplateField >
                    <ItemTemplate>
                    <asp:LinkButton runat="server" Text='<%#Eval("Description") %>' PostBackURL='<%#Eval("FilePath") %>' />
                    </ItemTemplate>
                    </asp:TemplateField>
                    </Columns>
                     <EmptyDataTemplate >  
                <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" style="border:0;" class="formLabelTd">
                <asp:Label ID="lblNoAttachments"   runat="server"  meta:resourcekey="lblNoAttachmentsResource" />
                </td></tr></table> </EmptyDataTemplate>
                    </asp:gridview>
                    </ItemTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField  meta:resourcekey="tfEditAttachmentsResource" HeaderStyle-Width="80px">
                    <ItemTemplate >
                        <asp:ImageButton ID="btnEdit" runat="server" OnCommand="btnAddPic_Command"
                         ImageUrl="~/_LAYOUTS/SCTAAcc2/Images/edit.png" CommandArgument='<%# Container.DataItemIndex %>' />

                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
               <EmptyDataTemplate >  
                <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"style="border:0;" class="formLabelTd">
                <asp:Label ID="lblNoData"   runat="server"  meta:resourcekey="lblNoDataResource" />
                </td></tr></table> </EmptyDataTemplate>
            </asp:gridview>

为什么它不工作?它有什么问题?
谢谢

4

1 回答 1

0

交出您在所需验证器中交出的控制权ValidationGroupradiobuttonlist

于 2013-07-03T13:06:06.513 回答