jQuery UI Widgets Forums Lists DropDownList Binding Dropdownlist data from Database

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 8 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Binding Dropdownlist data from Database #75854


    I have used below code to bind data from database to dropdownlist(Using asp.net). The code is returning values but is not getting bounded to Dropdownlist.

    <script type=”text/javascript”>
    $(document).ready(function () {
    source = {
    datatype: “xml”,
    datafields: [
    { name: ‘id’ },
    { name: ‘name’ }
    async: false,
    record: ‘Table’,
    url: ‘oemPatches.aspx/BindOEM’,
    var dataAdapter = new $.jqx.dataAdapter(source,
    { contentType: ‘application/json; charset=utf-8’ });
    source: dataAdapter,
    theme: ‘classic’,
    width: 200,
    height: 25,
    selectedIndex: 1,
    displayMember: ‘NAME’,
    valueMember: ‘ID’

    <div id=’ddlOEM’>

    Aspx.cs file
    [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Xml)]
    public static string BindOEM()
    SupportUI.classes.data.UtilityDAL dal = new SupportUI.classes.data.UtilityDAL();
    string query = “SELECT id, name FROM oems ORDER BY oem_name”;
    DataSet dsResult = dal.executeQuery(query);
    //// return the Customers table as XML.
    System.IO.StringWriter writer = new System.IO.StringWriter();
    dsResult.Tables[0].WriteXml(writer, XmlWriteMode.WriteSchema, false);
    return writer.ToString();
    //return JSON.FromDataTable(dsResult.Tables[0]);

    When seen in chrome browser dataadapter source is empty

    Binding Dropdownlist data from Database #75878


    Hi divya,

    Please take a look at our ASP .NET MVC demos and especially Bind DropDownList to SQL Database, which shows how to populate this widget from a database.

    Best Regards,

    jQWidgets team

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.