validation

G

Guest

I have a grid view. In that gridview I have somecheck boxes in
EditItemTemplate. I need to validate those check boxes. I am using
customValidate controls and java script to validate check boxes. but it gives
me error message that IsActiveCheckBox is not found in current context. Mat
be checkbox is in EditItemTemplate field. I am not sure. How can I fix this.
e'g
<script language="javascript" type="text/javascript">
function ValidateIsActiveCs(source, args)
{
args.IsValid = document.getElementById('<%=IsActiveCheckBox.ClientID
%>').checked;
}

<asp:CheckBox ID="IsActiveCheckBox" runat="server" Checked='<%#
Bind("MyColumn") %>' />
<asp:CustomValidator ID="cvlIsActive" runat="server"
ClientValidationFunction="ValidateIsActiveCs" ErrorMessage="This field
should be checked">*</asp:CustomValidator></td>
 
J

John

I have a grid view. In that gridview I have somecheck boxes in
EditItemTemplate. I need to validate those check boxes. I am using
customValidate controls and java script to validate check boxes. but it gives
me error message that IsActiveCheckBox is not found in current context. Mat
be checkbox is in EditItemTemplate field. I am not sure. How can I fix this.
e'g
<script language="javascript" type="text/javascript">
function ValidateIsActiveCs(source, args)
{
args.IsValid = document.getElementById('<%=IsActiveCheckBox.ClientID
%>').checked;
}

<asp:CheckBox ID="IsActiveCheckBox" runat="server" Checked='<%#
Bind("MyColumn") %>' />
<asp:CustomValidator ID="cvlIsActive" runat="server"
ClientValidationFunction="ValidateIsActiveCs" ErrorMessage="This field
should be checked">*</asp:CustomValidator></td>

I tried your code out and didn't get the error you had. However when
my submit button was clicked and the checkbox wasn't checked it
displayed the Text "*" not the ErrorMessage from the CustomValidator.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top