Skip to content
Loading
how to retrieve data using ajax in c# ASP.NET ? If Above solution not work then please change you datatype of column c_no to integer. and try will work.
+1
  • Farhan Ahmed
    https://www.aspdotnet-suresh.com/2011/01/introduction-here-i-will-explain-how-to.html
     
    https://stackoverflow.com/questions/30084568/populate-dropdownlist-using-ajax-mvc-4
     
    http://aspalliance.com/716_Populating_a_DropDownList_using_AJAX_and_ASPNET.4 
    +1
  • Laxmidhar Sahoo
    $("#ss_list").append($("").val
    (value.c_no).html(value.c_name));
    });
    +1
  • Omar Kh
    the data is comming look below
     
     
    i have tried  @
    Jenith Thakkar solution but with empty select
     
    +1
  • Laxmidhar Sahoo
    Hi
     
    Your code is looking good .
     
    1 -  check the data is comming or not . 
     
    2-  (value.c_no).html(value.c_name));
     
    The key should small letter that you define in class
     
    Thanks and regards 
    +1
  • Jenith Thakkar
    1. "text/javascript">  
    2. $(document).ready(function () {  
    3. $.ajax({  
    4. type: "POST", url: "remin.aspx/GetCustomers", dataType: "json", contentType: "application/json", success: function (res)  
    5. {  
    6. $.each(res.d, function (data, value) {  
    7. $("#ss_list").append($("").val(value.CountryId).html(value.CountryName));  
    8. })  
    9. }  
    10. });  
    11. })  
    12.   
    Use above code for jquery and instead of aspdropdownlist use
    1. "ss_list">"0" >--Select Country--  
    +1