Click here to Skip to main content
15,908,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have grid view with check boxes and outside radiobutton list how can i set requried feild validator at single button while click on button at we have to check box in grid view and radiobuttonlist
can u guide me or send any snippets
Posted

hi if u want to have this kind of functionality right click on the requiredField and goto properties and assign some value to ValidationGroup lets say 1 Now assign 1 to all other requiredFeild validations as well as on button which you want to be fired when it is clicked.
by using this only those validations will be fired whose ValidationGroup will matches with the button's Validation Group.
I hope this will solve your problem :)
 
Share this answer
 
v2
Comments
rajkumar.duvva 14-Sep-12 4:58am    
Hi,
My question is, i have a gridview which contains radio buttons in it.on clicking on a button called "save and submit", it should validate the user to select atleast one of the radio button. If not selected, it should display a message to select.Can any one help me please?
Sir;
What I understood that you have to make sure that at least one check box is checked when a certain value is selected in the radio list.
so, you need to add a custom validator with client validation function of
JavaScript
function ValidateItemCheck(sender, e){
    var selectedoption =  $("input[id^='<%= radiolist.ClientID %>_']:checked");
    if (selectedoption.val() == 'somevalue') {
        var gridview = $('#<%= gridview.ClientID %>');
        e.IsValid = (gridview.find('input[type=checkbox]:checed').length > 0)
    }
    else
        e.IsValid = true;
    }


for more information about CustomValidator please refer to http://asp.net-tutorials.com/validation/custom-validator/[^]
 
Share this answer
 

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