i am using jquery on an asp.net 3.5 site.
i have 2 radio button lists
listA and listB
when the 3rd radio button in listA is checked - listB becomes enabled.
when the 3rd radio button in listA is checked - you must select an item in listB. (or you see an serverside - error message)
I am using an asp:customValidator - which calls a serverside method
the method does the following:
public void ValidateListB(object o, ServerValidateEventArgs e)
if (listA.SelectedIndex == 2)
if (listB.SelectedIndex == -1)
e.IsValid = false;
This works the first time round, but when i do the following:
1. I selected a radio button in listB, save it down to the database.
2/ Then select the 2nd radio button in listA (so listB becomes disabled/ and the checked attribute is removed)
3. Then reselect the 3rd radio button in listB (so listB becomes enabled again)
4. But i do not select anything in listB - so the customvalidator should see this and raise an error
But it does not raise an error because for some reason:
listB.SelectedIndex == 0 and not -1
so server side - listB still thinks that its 1st radio button is selected - despite the jquery removeAttr("checked")
How can i resolve this problem?