ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
How to reset AjaxDropdown
Title:
B
I
{code}
?
Hi O! First, thank you for your very cool library. It's really fun to develope with, even if I'm sometimes really stuck. In the meantime I am quite familiar with its use, but sometimes I still have a trouble with the javascript. I'm trying to reset AjaxDropdown field to "undefined value" such as directly after load, where the "please select" text is shown. In a PopUpForm I have a "Reset" button and call my javascript in the parent page. <script type="text/javascript"> function resetFilter() { $('#InstanceName').data('api').load(); $.post("@Url.Action("ResetFilterMask","Database")"); } </script> This code snippet should reload InstanceName AjaxDropdown and reset my filter viewmodel. The second part will be executed (checked with debugger) but the AjaxDropdown is still set to the last selected value. Any hint? Generally, how to handle resetting fields without ClearButton? Regards
Save Changes
Cancel
TT Tom
asked at 09 Nov 2015
in general you do this: $('#id').val('').change() in the case of ajaxdropdown you need to have an item with value = '' in order for it to be selected after the clear
at 09 Nov 2015
Omu
Works perfectly!!!! Tnx
at 09 Nov 2015
TT Tom
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK