Click to See Complete Forum and Search --> : Custom Validation Controls


maverick786us
September 4th, 2007, 06:42 AM
I have used custom validation controls for Checkboxes and Required Valkidation Controls for TextBoxes.

I have associated the messages of all Validation Controls in a Validation Summary in the form of MessageBoxes.

All the messages are working but the custom Validation Control's message does'nt get displayed in the MessageBox.

Can someone help in resolving this problem??

Thanks in Advance

Shuja Ali
September 4th, 2007, 06:45 AM
You have not shown us the Function that ou are using to validate the Checkboxes. You have also not told us whether you are using Server-Side or Client-Side validation. Please put some more light on these.

maverick786us
September 4th, 2007, 06:57 AM
You have not shown us the Function that ou are using to validate the Checkboxes. You have also not told us whether you are using Server-Side or Client-Side validation. Please put some more light on these.

Here it is


HTML SECTION
<asp:CheckBox ID="chkAgreement" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Please Accept the Terms and Conditions"
OnServerValidate="ServerValidation" ValidationGroup="Required"></asp:CustomValidator></td>
....................................................................................................................
....................................................................................................................
<asp:ImageButton ID="btn_Submit" runat="server" Height="29px" ImageUrl="~/images/btn-submit.gif"
Width="88px" OnClick="btn_Submit_Click" ValidationGroup="Required" />
....................................................................................................................
....................................................................................................................
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowSummary="False"
ShowMessageBox="True" EnableTheming="true" HeaderText="Attention!" ValidationGroup="Required" />



This Event is accuring in the .cs file

protected void ServerValidation(object Source, ServerValidateEventArgs args)
{
args.IsValid = chkAgreement.Checked;
}


You can even see the attachment in which I have placed .aspx and .cs files

Thanks