ComboBox bind url instead of prepared list

Posted by: 1728884346 on 9 February 2020, 10:43 am EST

  • Posted 9 February 2020, 10:43 am EST

    may i know how to bind a url to ComboBox, so it will retrieve data when init control, instead bind prepared list which need ready before load control?
  • Replied 9 February 2020, 4:11 pm EST


    There is no direct way to bind the ComboBox to a URL. You will need to make an Ajax call to the URL and bind the ComboBox with the data that is returned. Please refer to the code snippet below and the sample attached:

    In cshtml:
    @(Html.C1().ComboBox()   .DisplayMemberPath("CategoryName").SelectedValuePath("CategoryName").Id("category").Placeholder("Loading....").CssStyle("margin-top", "20px"))

    In JS:
    c1.documentReady(function () {
    var url = '';
    wijmo.httpRequest(url, {
    success: function (xhr) {
    var data = JSON.parse(xhr.responseText);
    var cb = wijmo.Control.getControl('#category');
    cb.itemsSource = data;

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels