Skip to content
Loading
  • Laxmidhar Sahoo
    +1
    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
  • Omar Kh
    +1
    the data is comming look below
     
     
    i have tried  @
    Jenith Thakkar solution but with empty select
     
    +1
  • Laxmidhar Sahoo
    +1
    $("#ss_list").append($("").val
    (value.c_no).html(value.c_name));
    });
    +1
  • Farhan Ahmed
    +1
    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
  • Jignesh Kumar
    +1
    Hi,
     
    Please use this link which has same implementation will solve your issue.
     
    https://www.c-sharpcorner.com/blogs/bind-dropdown-using-jquery-ajax
    https://www.aspsnippets.com/Articles/Populate-Bind-ASPNet-DropDownList-using-jQuery-AJAX-and-JSON-in-C-and-VBNet.aspx 
     
    1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="WEBDBIRAQI.test1" %>    
    2.     
    3.     
    4.     
    5. "http://www.w3.org/1999/xhtml">    
    6. "server">    
    7.     "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">    
    8.       "text/javascript">    
    9.           (document).ready(function () {    
    10.               $.ajax({    
    11.                   type: "POST",    
    12.                   contentType: "application/json; charset=utf-8",    
    13.                   url: "remin.aspx/GetCustomers",    
    14.                   data: "{}",    
    15.                   dataType: "json",    
    16.                   success: function (Result) {    
    17.     
    18.                       $.each(Result.d, function (key, value) {    
    19.                           $("#ss_list").append($("").val    
    20.                           (value.c_no).html(value.c_name));    
    21.                       });    
    22.                           
    23.                   },    
    24.                   error: function (Result) {    
    25.                       alert("Error");    
    26.                   }    
    27.               });    
    28.           });    
    29.         
    30.         
    31.     
    32.     
    33.     "form1" runat="server">    
    34.     
          
    35.     "ss_list"   runat="server" >    
    36.     
        
  •         
  •     
  •    
  •  If Above solution not work then please change you datatype of column c_no to integer. and try will work.
    +1