.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

To check atleast one check box is selected in the grid or not

Posted By:Maverick       Posted Date: July 21, 2011    Points: 40    Category: Javascript    URL: http://www.dotnetspark.com  

To check atleast one check box is selected in the grid or not
 

Hello All,

This javascript will check that atleast one check box is selected in grid during edit or delete operations.

 

                function ValidateFileUploadForResult(checkBox) {                     var frm = document.forms[0];                     var flag = false;                     var cnt = 0;                     for (var i = 0; i < document.forms[0].length; i++) {                         if (document.forms[0].elements[i].id.indexOf(checkBox) != -1) {                             if (document.forms[0].elements[i].checked) {                                 flag = true                                 cnt = cnt + 1;                             }                         }                     }                     if (flag == false) {                         alert('Please select at least one record.')                         return false                     }

}

 

Hope it helps.


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend