jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox jqxComboBox Binding to SQL Result

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • jqxComboBox Binding to SQL Result #31836

    danw217
    Member

    Hello good night,

    I need Binding a jqxComboBox to SQL Result, How I do this?

    I dont want create a XML file to do this.

    Thanks,

    Actually I have this code and I use ASP.NET and C#:

    function LlenarComboSectorIndustrial() {
    //var theme = getDemoTheme();
    var url = “FuenteCombos/empresas.xml”;
    // prepare the data
    var source =
    {
    datatype: “xml”,
    datafields: [
    { name: ‘ID’, map: ‘\\:ID’ },
    { name: ‘Nombre’, map: ‘\\:Nombre’ },
    ],
    root: “NewDataSet”,
    record: “Table1”,
    id: ‘\\:ID’,
    url: url
    };
    var dataAdapter = new $.jqx.dataAdapter(source, { async: false });
    // Create a jqxComboBox
    $(“#jqxWidget”).jqxComboBox({ selectedIndex: 0, source: dataAdapter, displayMember: “Nombre”, valueMember: “ID”, width: 200, height: 25, theme: ” });
    $(“#jqxWidget”).on(‘select’, function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    var valueelement = $(“

    “);
    valueelement.text(“Value: ” + item.value);
    var labelelement = $(“

    “);
    labelelement.text(“Label: ” + item.label);
    $(“#selectionlog”).children().remove();
    $(“#selectionlog”).append(labelelement);
    $(“#selectionlog”).append(valueelement);
    }
    }
    });

    jqxComboBox Binding to SQL Result #31840

    Peter Stoev
    Keymaster

    Hi danw217,

    I do not see a problem in that code. It depends on what your server returns as a data. If you post the XML data or part of it, we would be able to check whether the dataAdapter is initialized according to your data source and help with code for binding the ComboBox.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.