Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi...anyone can help on how to Bind the radio button list via Javascript or JQuery?
Data is array list return from Json and webservice.

JavaScript
$.ajax(
        {
         type: "POST",
         url: "../../Webservice/Control.asmx/getIdea",
         data: "{'D':'" + HP + "'}",
         contentType: "application/json",
         dataType: "json",
         success: function (data) {
         for (var i = 0; i < data.d.length; i++) {
           AddListItems(rblIdea, data.d[i].MGrpT, data.d[i].MGrpV);    
        }
         },
               failure: function (response) {
                   alert(response.d);
               }
           });
Posted
Updated 6-Oct-11 1:17am
v2

1 solution

ASP.NET 4.0 has the ability to do client-side data binding Data Binding in ASP.NET AJAX 4.0[^]

If you are not using 4.0, then it is simply a matter of iterating through your array and appending html elements to the container

JavaScript
$("#mySelect").append("<option>" + some value + "</option>");


http://jquery.com/[^]
 
Share this answer
 
Comments
cindy_03 7-Oct-11 22:12pm    
Thanks for your 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