Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have a radiobuttonlist populated dynamically like below.
List<DataManagement.Models.Role> list = (List<DataManagement.Models.Role>)ViewData["rolelist"];
    foreach (var a in list)
    {
            @Html.RadioButton("Role", "RoleID", true,  @a.RoleName.ToString();
    }


how can i handle click event of this radiobuttons

please help me

Thanks and regards
Kunjammu
Posted

1 solution

Put a common css class for every radiobutton that you are dynamically generated like below
C#
@Html.RadioButton("Role", "RoleID", true, a.RoleName.ToString(),new{@class="classname"})


by using jQuery you can make a click event using css class like below
C#
$(document).ready(function(){
$('.classname').click(function()
{
});
});


Hope this helps
 
Share this answer
 
Comments
Kunjammu 14-Jul-13 23:46pm    
thanks..:)

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