2012-09-14 30 views
0

如何添加(綁定)Requiredfieldvalidator控件到formview itemtemplate?如何將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

你試圖驗證<軌道:控制RUNAT = 「服務器」 ID =」如果是,那麼只需在ControlToValidate =「Purch」中使用「Purch」即可。 – 2012-09-14 06:05:47

回答

0

所以,你只需要改變,如下的RequiredFieldValidator:

<asp:RequiredFieldValidator ID="PurchaseOrg" runat="server" 
ControlToValidate="Purch" ErrorMessage="<" EnableClientScript="false" 
Enabled="false" ></asp:RequiredFieldValidator> 
+0

我想添加validatror控件到這個字段.. – Lakki

+0
相關問題