Hi ,
I need to use WebCombobox as autofill textbox.It should autofill the available item from list if not available i should use the newly entered item to insert to database.
Some how i am not able to get the text enetered which is not avaialble in the combobox as SelectedItem is returning as null.Any thoughts how to solve this problem or better way of doing it.
Thanks .
Hello,
I assume you are using the WebDropDown since WebComboBox is retired and not supported anymore.
If there is no item available and you need to enter a new value it does not become selected automatically, this is why you are getting null. What you can do is handle the ItemAdded client side event as follows:
function WebDropDown1_ItemAdded(sender, eventArgs){ var item = eventArgs.get_value(); // will return the added item var enteredText = item.get_text(); // will return the entered string, i.e. the item's text}
Be aware that you need to have EnablePersistingCustomValues property set to true for this scenario to work:
<ig:WebDropDown ID="WebDropDown1" runat="server" EnablePersistingCustomValues="True">
Please let me know if this helps. If you have further questions on the issue, please let me know, I will be glad to help.
Its solved my problem...I just set the EnablePersistingCustomValues="True" and also used CurrentValue instead of SelectedItem.Value .Thats solved my issue.
Thanks..