テキストボックスがvisible = false
の場合、 RequiredFieldValidator を実行しないでください。
これは私のaspxコードです:
<asp:TextBox runat="server" ID="txtAmt" MaxLength="7" Style="width: 100px;"/>
<asp:RequiredFieldValidator ValidationGroup="ln" runat="server" ControlToValidate="txtAmt"
Display="Dynamic" ErrorMessage="Required" />
今私のコードビハインドで
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
txtAmt.Visible = false;
}
}
それでも私のボタンクリックハンドラーでは、テキストボックスが空の場合Page.IsValid
に戻ります。false
この問題を解決する方法はありますか?