如何添加(绑定)Requiredfieldvalidator控件到formview itemtemplate?
<tr runat="server" >
<td style="width: 120px">
<asp:Label Text="Purchase Org.:" ID="LabelPurchOrg1" runat="server"> </asp:Label>
</td>
<td>
<orbit:Control runat="server" ID="Purch" Text='<%# Eval("Site")%>' LabelPosition="Right" CssClassLabel="SectionTextLookup" RenderTextBoxAsLabel="true" EnableLabel="true" EnableTooltip="true" LookupCommand="sit" />
<asp:RequiredFieldValidator ID="PurchaseOrg" runat="server" ControlToValidate='<%# Eval("Site") %>' ErrorMessage="<" EnableClientScript="false" Enabled="false" >
</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</ItemTemplate>
答案 0 :(得分:0)
所以你只需要更改RequiredFieldValidator,如下所示:
<asp:RequiredFieldValidator ID="PurchaseOrg" runat="server"
ControlToValidate="Purch" ErrorMessage="<" EnableClientScript="false"
Enabled="false" ></asp:RequiredFieldValidator>