Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have 2 radio Buttons with IDs rdoYes and rdoNo on my Page,
then what I want is if radio button with id rdoYes is checked then when the user Click on the button it should not causes Validation on my page(has RequeiredFieldvalidator)
This is this code I am using but it is not working,it is still causing validation:

$("btnContinue").click(function(e) {
if ($("#<%=rdoYes.ClientID %>").attr('checked', 'checked'))
e.preventDefault();
});

By the way btnContinue is the ID of the button that causesvalidation OnClick event.

Help!
Posted
Comments
ZurdoDev 8-Mar-13 7:14am    
$("btnContinue") - shouldn't this be $("#btnContinue")
El Dev 8-Mar-13 7:52am    
I have changed but still not working
this is how:
$('#btnContinue').click(function(e) {
if ($("#<%=rdoYes.ClientID %>").attr('checked', 'checked'))
e.preventDefault();
});

1 solution

maybe you can add an attribute to the btnContinue tag -

HTML
clientidmode="Static"


see if it woks
 
Share this answer
 
Comments
El Dev 8-Mar-13 11:43am    
no Clientidmode attribute for the button control...
Kolkata .NET 8-Mar-13 11:49am    
ok, then its my fault i estimate i the wrong way. i was expecting it to be a asp button with runat server attribute.

execute your asp page. see if the id of the button is distorted to something else. it can help us find a solution. or see if jquery is getting the correct client id of the radio button

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900