I created UserControl With Textbox,Ajax Calender control, RequiredField Validator and CustomValidator
Required Validator is working fine in Textbox but Custom validator is not displaying Error Message.
Without using Usercontrol Custom validator is working (i.e. directly this validation controls placed in Default.aspx)
but using UserControl its not working.
I wrote Date Format Validation in Custom Validor
--------Calender.ascx
<td valign="top">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
<td valign="top">
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="TextBox1" Format="dd/MM/yyyy"
TargetControlID="TextBox1">
</cc1:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="Please Choose Date"></asp:RequiredFieldValidator>
<asp:CustomValidator ID="Customvalidator1" Runat="server" Enabled="True" Display="Dynamic" Visible="false"
ClientValidationFunction="ValidateTextBox1" ControlToValidate="TextBox1"
EnableClientScript="False" ErrorMessage="Invalid DateTime Format"
OnServerValidate="CustomValidaorMethod"></asp:CustomValidator>
</td>
-----calender.ascx.cs
public void CustomValidaorMethod(object source, ServerValidateEventArgs args)
{
-- date formating validation code
}
Please give me the reply, this reply will be helpful to me further developing programming skills
Thank u
waiting for yours reply as soon as possible