我的页面上有一个RequiredFieldValidator
文本框,并且想要启用或禁用 . 因为我想检查所需Option
的内容是否true
适用RequiredFieldValidator
于该文本框。
<asp:TextBox ID="txtReference" runat="server" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtReference"
Display="None" ErrorMessage="Reference Should Not Blank !" ValidationGroup="Ac"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender9" runat="server"
Enabled="True" TargetControlID="RequiredFieldValidator1">
</ajaxToolkit:ValidatorCalloutExtender>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender7" runat="server" CompletionInterval="100"
DelimiterCharacters="" EnableCaching="False" Enabled="True" FirstRowSelected="True"
MinimumPrefixLength="1" ServiceMethod="GetReference" ServicePath="" TargetControlID="txtReference">
</ajaxToolkit:AutoCompleteExtender>
我尝试这样做但不起作用的代码
if (_clients.ReferenceRequired == true)
{
RequiredFieldValidator1.Enabled = true;
AutoCompleteExtender7.Enabled = true;
}
else
{
RequiredFieldValidator1.Enabled = false;
AutoCompleteExtender7.Enabled = false;
}
但这在我的页面上找不到我的控件,我该怎么做?