You must Sign In to post a response.
  • Category: JQuery

    How to get data from database and bind to checklistbox using jquery

    hi folk,

    i want to get data from database and bind to checklistbox with count also ..

    please share some link or some code


    thank you in advance


    regards,
    abhijit patil
    http://dotnetbyabhipatil.blogspot.in
  • #763695
    Hi Abjit,

    For getting database records and shows the same in our control using Jquery then we have one simplest way is using AJAX call, how to call database data using AJAX call? for that we need to create webmethod and using below code we can able to retrieve the webmethod.


    $(function () {
    $.ajax({
    type: "POST",
    url: "PageName.aspx/WebMethod",
    data: '{}',
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: your action,
    failure: function (response) {
    //failure case
    },
    error: function (response) {
    //error case
    }
    });
    });


    you can get your webmethod using URL showed in above script, if you want to know how to achieve this with simple example, then I suggest you to refer below link here they will explain you how to do the same, "aspsnippets.com/Articles/Populate-CheckBoxList-from-database-using-jQuery-AJAX-and-JSON-in-ASPNet.aspx"

    Hope this will helpful to you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #763794
    Hai Abhijit Patil,
    There is very popular client side method $.Ajax to call a server side method to get the data from the database, asynchronously.
    So you can make use of this method. Once you get the data you can use the code to fill the checklistbox as below:

    http://codewala.net/2013/08/26/bind-a-checkbox-list-from-database-using-jquery-ajax/

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments