I have a series of webdropdown controls on my page which utilize Javascript and server-side methods to dynamically add/remove values from the lists. For example, if I have 3 webdropdown controls, each has a list of numbers 1-10. After the user picks number 1 in the first webdropdown, number 1 must be removed from the other two webdropdown lists (since it's already used). If the user picks number 2 in the second webdropdown, number 2 must be removed from the first and third webdropdown lists.
My question is...after the user picks a number, the page does a postback and as the code is stripping off the number from each dropdownlist (box), that dropdownlist automatically opens to show the updated list. Is there a property/method that can control this and always keep the dropdownlist closed unless the user explicitly clicks on the arrow to open it?Thank you,Chris
Hi Chris,
Thank you for posting in the community.
In this case I suggest that you try handling the Initialize client-side event of your WebDropDowns and calling:
sender.closeDropDown();
Please let me know if this helps.
If I'm understanding correctly, I added the <ClientEvents> tag to my webdropdown:<ig:WebDropDown ID="ddlSCP1" runat="server" Width="350" AutoPostBack="true"SelectedValue='<%# DataBinder.Eval(Container.DataItem,"sprac1")%>OnItemsRequested="ddlSCP1_OnItemsRequested"OnPreRender="ddlSCP1_OnPreRender"OnDataBound="ddlSCP1_OnDataBound" Visible="true" EnablePaging="false"PageSize="10" EnableRenderingAnchors="false" ForeColor="Black"OnSelectionChanged="ddlSCP1_OnSelectionChanged"EnableClosingDropDownOnSelect="true"><ClientEvents Initialize="ddlSCP1_closeDropDown" /><DropDownItemBinding TextField="dept_desc" ValueField="dept_code" /></ig:WebDropDown>The Initialize event calls this Javascript function:
function ddlSCP1_closeDropDown(sender) { sender.closeDropDown();}As FYI, I also have this Javascript function that runs at page load:function pageLoad(sender, args) { if (_isInitialLoad) { _isInitialLoad = false; var timer_is_on = 0; if (!timer_is_on) { timer_is_on = 1; t = setTimeout("checkddlSNOM5Loaded()", 500); } }}This is the primary function to determine when it's time to execute (other) Javascript that add/removes numbers from the series of webdropdown controls.When my page loads, if the webdropdown has a SelectedValue, the dropdown list (box) opens and stays open until I click somewhere else on the page. Do I need to use the same Initialize function somewhere else so that the webdropdown stays closed after page load and after the Javascript logic completes?Chris