1) My WebDropDown has multi-select checkbox functionality with “Select All” feature implemented through the client-side SelectionChanged event.
2) Now if I implement the server-side OnSelectionChanged event by enabling the AutoPostBackFlags-SelectionChanged=”On”, on selecting an element I get a pop-up error saying “Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.” Also the event gets fired after every selection whereas we want the event to execute only after all the selections are done and when the dropdown is closed.
3) I tried implementing this solution from the forum but it doesn’t help - http://community.infragistics.com/forums/t/32575.aspx
<script type="text/javascript">
function selectedIndexChanged(sender, eventArgs) {
/*
*/
}
function dropDownClosed(sender, args) {
var dd = sender._callbackManager.createCallbackObject();
sender._callbackManager.execute(dd, true);
</script>
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" EnableMultipleSelection="True" EnableClosingDropDownOnSelect="False" OnSelectionChanged="WebDropDown1_SelectionChanged">
<ClientEvents SelectionChanged="selectedIndexChanged" DropDownClosed="dropDownClosed" />
</ig:WebDropDown>
This fires the server-side event after the selections are done and when the dropdown is closed but leaves the dropdown still open.
I will appreciate any help from the user community!
Hi,
if you don't want to have a postback after every selection, then you shouldn't set AutoPostBackFlag to On or Async. It is not possible to cancel selection and have selection at once at the same time, once the list is closed.
I suggest the following approach - keep your current code, but only remove the autopostback flags settings, so that there is no postback.
In the DropDownClosed client-side event handler, do that:
It's always good to also put a flag, so that in the closing handler, it knows when to do postback. I.e. do postback only when there was change in the selection. Otherwise it will do an async postback everytime the dropdown is closed.
If this doesn't help and the dropdown is still open, i would handle the Initialize client-side event, check whether the dropdown is open and if it is , close it, or just always close it by calling this function:
dropDown.closeDropDown();
Then the functions that you already have become like this:
var selectionChanged = false;
selectionChanged=true;
if (selectionChanged)
{
selectionChanged=false;
This should work fine, i don't know why it leaves the dropdown still open. Could you try and let me know whether it works?
Thanks,
Angel
Angel,
Thank you for your response.
I tried both of your solutions and both didn't work.
Initialize client-side event is called only for the first time and not after the async post-back following the DropDownClosed client-side event thus leaving the dropdown open.
The second option using the variable selectionChanged helped in not doing an async post-back the 2nd time but it still keeps the dropdown open.
I would appreciate any more ideas!
Thanks