C1ComboBox.OnClientTextChanged

Originally Posted 5 December 2013, 12:27 pm EST

  • Originally Posted 5 December 2013, 12:27 pm EST

    Hello.

    I need to react on custom text input in the combobox. I found the OnClientTextChanged event, but it only gets fired once after the page load but not when I change the text in the combo. Any tips why?

    Thank you
  • Reply

    Hello,

    Have you set the "AutoPostBack" property of the C1ComboBox to true? If yes then this will cause a page reload, everytime you select an item in the ComboBox. In my testing the "OnClientSelectedIndexChanged" works fine and fires as soon as I select an item. Please take a look at the C1ComboBox markup below where the "AutoPostBack" property is set to false:

            <wijmo:C1ComboBox ID="C1ComboBox1" runat="server" OnClientSelectedIndexChanged="selectionChanged"
    Text="Select an Item" AutoPostBack="false">
    <Items>
    <wijmo:C1ComboBoxItem Value="Item1" Text="Item1" />
    <wijmo:C1ComboBoxItem Value="Item2" Text="Item2" />
    <wijmo:C1ComboBoxItem Value="Item3" Text="Item3" />
    <wijmo:C1ComboBoxItem Value="Item4" Text="Item4" />
    </Items>
    </wijmo:C1ComboBox>


    Also, I have defined the selectionChanged function like this:

    function selectionChanged(e, args) {
    alert("The selected Item is: " + args.selectedItem.label);
    }


    Please try this code and let me know if you are able to get the desired results.

    Regards,
    Sankalp
  • Reply

    Hello.

    The AutoPostBack property is set to False and I need to react on custom text input not just the SelectedIndexChanged. In my case the user can pick a value from the combo or he can enter a custom value in the input. The OnClientTextChanged event looks like the one that should fire each time the text in the input changes but unfortunately it doesn't.
  • Reply

    Hello,

    If you want to detect the change in text while typing then you will need to use the underlying input class for C1ComboBox and bind the keyup event like this:

            $(document).ready(function () {
    $(".wijmo-wijcombobox-input").keyup(function (e) {
    //Your code here..
    });
    });


    Let me know if this helps.

    Regards,
    Sankalp
Need extra support?

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

Learn More

Forum Channels