Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

RequiredFieldValidator not working when Ajax

$
0
0

I have a couple of controls on my page that when a selection is made from a drop down will either enable or disable the RequiredFieldValidator.  When I enter the screen and hit the button it displays the required text, but once I make a selection in the drop down the RequiredFieldValidator will no longer work.  Is there any issues with this? 

protected void ddlistMailLog_SelectedIndexChanged(object sender, EventArgs e)
        {
            rfvMailDate.Enabled = ddlistMailLog.SelectedValue != "NA";
            rfvMailTo.Enabled = ddlistMailLog.SelectedValue != "NA";
            MailDateSpan.Visible = ddlistMailLog.SelectedValue != "NA";
            MailToSpan.Visible = ddlistMailLog.SelectedValue != "NA";
            }        }

<tr><td><span id="MailToSpan" class="required" runat="server">*</span></td><td>
     Mail To:</td><td><asp:TextBox ID="tbMailTo" runat="server" Columns="50" MaxLength="100"></asp:TextBox><asp:RequiredFieldValidator ID="rfvMailTo" runat="server" ControlToValidate="tbMailTo"
            Enabled="True" ErrorMessage="Required" SetFocusOnError="true" ValidationGroup="Main"></asp:RequiredFieldValidator></td></tr><tr><td><span id="MailDateSpan" class="required" runat="server">*</span></td><td>
      Mail Date:</td><td><rad:RadDatePicker ID="tbMailDate" runat="server"></rad:RadDatePicker><asp:RequiredFieldValidator ID="rfvMailDate" runat="server" ControlToValidate="tbMailDate"
       Enabled="True" ErrorMessage="Required" SetFocusOnError="true" ValidationGroup="Main"></asp:RequiredFieldValidator></td></tr>




Viewing all articles
Browse latest Browse all 5678

Trending Articles