Select Checkboxlist value in mvc4

Select Checkboxlist value in mvc4

Step1 : First Create View as Folowing  

 @foreach (var item in @ViewBag.Hobby)
        {      
          <input type="checkbox" name="ips"  value="@item.HobbyName" />@item.HobbyName
        }


Step 2 : Now you can select checkbox list value using jquery as following code

function InsertData()
   {
       $('input:checkbox:checked').each(function () {
   
        v = v + $(this).attr('value') +",";
    });
   }


Step 3 : When you click on checkbox  data can be selected using js  you can pass these data by calling ajax methode
Previous
Next Post »

2 comments

Write comments
Anonymous
AUTHOR
12 September 2016 at 01:22 delete

hi........

Reply
avatar
Chetan
AUTHOR
12 September 2016 at 01:24 delete

yes, have you any prob ?

Reply
avatar